About Document Objects

A browser's document objects don't exist until the Web page fully loads in the browser. At that point, the objects exist and any client-side scripting language can access them. This means, of course, JavaScript and JScript, but also VBScript (or any other script that happens to come along).

Objects are placed into the DOM based on load order. For example, if you're looking for document.forms[2], then look in your HTML code for the third <form> tag. No matter where on the actual page that form is, it's the third element in the form array because it's the third form the browser detected. And, as you'll see in a later chapter, one frame's code can't access another frame's script until the other frame has been loaded.

Properties ...

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.