Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does the javascript parser work?

 
Malith Yapa
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64606
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic