Document | NN 6 IE n/a DOM 1 | ||||||||||||||
The document object described earlier is, in the W3C DOM structure, more specifically an HTMLDocument node, a member of the HTML module of the standard. The HTMLDocument node inherits the properties and methods of the Document node (with an uppercase "D" described here, and defined in the W3C DOM Core module. This is the pure, abstract Document node, and all that is needed to contain an unrendered XML document. |
|||||||||||||||
Netscape 6 extends this node with a load( ) method that allows scripts to load XML documents into a plain (and unseen) Document node. Such a node is created via the document.implementation.createDocument( ) method. Scripts can then access the XML data in that document through regular W3C DOM document tree properties and methods. |
|||||||||||||||
To help reinforce in your mind the heritage of the document object you normally script (that is, the instance of the HTMLDocument node represented in each window's document), I show the lists of properties and methods for the core Document object. For descriptions of all these properties and methodsexcept for the uninherited Netscape 6-specific load( ) methodsee the document object, earlier in this chapter. |
|||||||||||||||
Object Model Reference | |||||||||||||||
documentNodeReference
|
|||||||||||||||
Object-Specific Properties | |||||||||||||||
|
|||||||||||||||
Object-Specific Methods | |||||||||||||||
|
|||||||||||||||
Object-Specific Event Handler Properties | |||||||||||||||
None. |
load( ) | NN 6 IE n/a DOM n/a |
load("URI") | |
Loads an XML file into the current Document object. Attempting to load other types of files (such as HTML) throws an exception. The server must be configured to send the file as the text/html content type. |
|
Parameters | |
|
|
Returned Value | |
None. |
readyState | NN n/a IE 4 DOM n/a |
Read-only | |
Returns the current download status of the object's content. If a script (especially one initiated by a user event) can perform some actions while the document is still loading, but must avoid other actions until the entire page has loaded, this property provides intermediate information about the loading process. You should use its value in condition tests. The value of this property changes during loading as the loading state changes. Each change of the property value fires an onReadyStateChange event (the event does not bubble). |
|
When introduced with IE 4, the property was available for only the document, embed, img, link, object, script, and style objects. IE 5 expanded coverage to all HTML element objects. |
|
Example | |
if (document.readyState == "loading") { //statements for alternate handling while loading } |
|
Value | |
For all but the object element, one of the following values (as strings): uninitialized | loading | loaded | interactive | complete. Some elements may allow the user to interact with partial content, in which case the property may return interactive until all loading has completed. Not all element types return all values in sequence during the loading process. The object element returns numeric values for these five states. They range from 0 (uninitialized) to 4 (complete). |
|
Default | |
None. |
title | NN 6 IE 4 DOM 1 |
Read/Write | |
Provides an advisory description of the element. When the element is one that has a physical presence on the page, the browser renders the value of this property as a floating text label when the cursor rests atop the element for a moment. The size, font characteristics, and color of this label are not within control of scripting. |
|
Example | |
document.getElementById("elementID").title = "Hot stuff!";
|
|
Value | |
String. |
|
Default | |
Empty string. |