The Document Object

The Document object represents the HTML document currently displayed by the browser. Its properties reflect the characteristics of the page, and allow script code to manipulate and react to different conditions. Among the most interesting properties are the anchors, links, and forms collections, which represent all of the anchors, links, and forms respectively, on the page. The Document object also supports some methods that can be used to change the HTML displayed by the browser. These methods duplicate much of the functionality that ASP provides, but differ in that the HTML manipulation is done after the document is transmitted from the server instead of before. When these methods are used, the server sends an HTML document with embedded script code, and the browser interprets it and displays the resulting HTML. The Document object has no events.

This section covers the Document object and it’s descendants, with one exception. One of the most used parts of the Document object is the Elements collection of the Document's Form object. This part of the object model is used when interacting with the elements of an HTML form, like buttons, text boxes, radio buttons, and so on, and is important enough to warrant its own section. We’ll cover the Elements collection and the Element object as soon as we’re through with the Document object. Finally, when we cover the anchors, links, and forms collections, we’ll also talk about the objects that make up these collections: Anchor, Link, and Form.

So, without further ado, lets get right into it by talking about the methods that are part of the Document object.

© 1997 by Wrox Press. All rights reserved.

Show: