GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes How does the javascript parser work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How does the javascript parser work?" Watch "How does the javascript parser work?" New topic
Author

How does the javascript parser work?

Malith Yapa
Ranch Hand

Joined: Jan 17, 2007
Posts: 45
Hey guys,

When an html page is being loaded to a browser how does it manage between javascript and html..

For an instance if i tried to use the getElementById("X"); before the element is defined on the html document , will there be an error , or will javascript interpreter wait for html document to load and return the element object..
[ June 08, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

There will be an error if the script executes before the DOM is finished loading.

It would take you less than two minutes to write a page to test this out.
[ June 08, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: How does the javascript parser work?