File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
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: 61760
    
  67

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does the javascript parser work?