Re: [WSG] getElementById() always returns null

2005-12-07 Thread Roberto Gorjão
Hi Chris, As JavaScript isn't a precompiled language (rather a scripting one), functions, objects and variables are processed one after another, following the source order. When you declare your variables, the browser is not yet aware of the existence of the two requested elements. You have

Re: [WSG] getElementById() always returns null

2005-12-06 Thread malla reddy
Dear All, Let you know why this problem is coming. Actually I am a bit busy with my work, if not I would have sent the cause. Regards, Malla --- Ben Wong [EMAIL PROTECTED] wrote: It's because the code is being executed before the tags with the matching ids are created. On 12/6/05, Chris

Re: [WSG] getElementById() always returns null

2005-12-05 Thread Ben Wong
It's because the code is being executed before the tags with the matching ids are created. On 12/6/05, Chris Lamberson [EMAIL PROTECTED] wrote: Through foresight, i already know this will be a very pitiful question to real web designers, so bear with me. I was having some trouble finding out

RE: [WSG] getElementById() always returns null

2005-12-05 Thread Smith, Eric E \(EM, PTL, Kelly Services, Contractor\)
The _javascript_ that's assigning the behavior to your elements is completing before the elements are in the dom. Try putting your _javascript_ code in a function and calling that function with window.onload like this: script type="text/_javascript_" window.> function do() { var toggle

Re: [WSG] getElementById() always returns null

2005-12-05 Thread Bert Doorn
G'day I was having some trouble finding out why, whenever I call for document.getElementById(id), it returns null (even if there is a valid id-matching element). Consider something simple, like this: The javascript runs as the page loads. At that point, the elements with the ids do not yet

Re: [WSG] getElementById() always returns null

2005-12-05 Thread Alan Trick
What browser are you using? That should work on most of them, but Internet Explorer has a mis-feature were it does something really wierd. I think what it does is assigns elements with id's to variables with the id's name. I'm not sure though, I haven't tested it out enough. The consequence

Re: [WSG] getElementById() always returns null

2005-12-05 Thread Alan Trick
Nevermind, ignore what I said, Bert is right. Although IE may misbehave as well, it seems pretty inconsitent and buggy. On Tue, 2005-12-06 at 09:21 +0800, Bert Doorn wrote: G'day I was having some trouble finding out why, whenever I call for document.getElementById(id), it returns null

Re: [WSG] getElementById() always returns null

2005-12-05 Thread Felix Miata
Chris Lamberson wrote: I think that's the problem I had on both http://members.ij.net/mrmazda/tmp/dpi-broken.html and http://members.ij.net/mrmazda/auth/dpi-screen-window.html in certain development builds of Gecko recently until I got some help with a workaround now found in the latter but not