[Javascript] getElementsByTagName not working ???

James james at southspace.org
Thu Jul 21 08:34:54 CDT 2005


I guess I thought -  the page would load into the browser, then the HTML 
parsed into a data structure (DOM) and then the script run (things like 
document.write executed) and finally the page rendered/displayed.

but it makes sense that it just ploughs straight into it as it comes... 
it's not a problem in the slightest, I am just surprised I didn't know 
about it until now.

James


At 14:30 21/07/2005, you wrote:
>When the browser is parsing an html page and it is comming across a 
><script> tag, it'll parse the contents immediately, because there can be 
>document.write('<span>bla</span>') like statements inside there that need 
>to be parsed at that point. So, when you need to access HTML elements like 
>the anchor you are trying, it must be parsed by the browser at the time 
>your script is fired.
>
>Kim
>
>>Hell, I didn't know you had to worry about that.....
>>
>>Thanks all
>>
>>James
>>
>>At 13:52 21/07/2005, you wrote:
>>
>>>Are you calling this *after* the page loads? Or at least after that
>>>link exists?  :-)
>>>
>>>--
>>>Hassan Schroeder ----------------------------- hassan at webtuitive.com
>>>Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>>>
>>>                           dream.  code.
>>>
>>>
>>>_______________________________________________
>>>Javascript mailing list
>>>Javascript at LaTech.edu
>>>https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
>>_______________________________________________
>>Javascript mailing list
>>Javascript at LaTech.edu
>>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list