Navigator 2.0, Internet Explorer 3.0; enhanced in Navigator 3.0
window.document document
An instance of the Document object is stored in the document field of the Window object. As a special case, when referring to the Document object of the current window (i.e., the window in which the JavaScript code is executing), you can omit the window reference, and simply use document.
A string that specifies the color of activated links. May be set in the document <HEAD> or through the ALINK <BODY> attribute.
An array of Anchor objects; one for each hypertext target in the document.
A read-only integer specifying the number of elements in the anchors[] array.
An array of Java objects, one for each <APPLET> that appears in the document. Navigator 3.0 and higher.
A read-only integer specifying the number of elements in the applets[] array. Navigator 3.0 and higher.
A string that specifies the background color of the document. Initially set through the BGCOLOR <BODY> attribute.
A string, which is the value of a cookie associated with this document.
A string that specifies the Internet domain from which the document is from. This property is used for security purposes. Navigator 3.0 and higher.
An array of Java objects, one for each <EMBED> tag that appears in the document. Navigator 3.0 and higher.
A read-only integer that specifies the number of elements in the embeds[] array. Navigator 3.0 and higher.
A string that specifies the color of document text. May be set in the document <HEAD> or through the TEXT <BODY> attribute.
An array of Form objects, one for each <FORM> that appears in the document.
A read-only integer specifying the number of elements in the forms[] array.
An array of Image objects, one for each image embedded in the document with the <IMG> tag. Navigator 3.0 and higher.
The number of elements in the images[] array.
A read-only string that specifies the date of the most recent change to the document (as reported by the web server).
A string that specifies the color of unvisited links in the document. May be set in the document <HEAD> or through the LINK <BODY> attribute.
An array of Link objects, one for each hypertext link in the the document.
A read-only integer specifying the number of elements in the links[] array.
A synonym for the URL property. Not the same as the Location object window.location.
A synonym for the embeds[] array. Navigator 3.0 and higher.
The number of elements in the plugins[] or embeds[] array. Navigator 3.0 and higher.
A read-only string that specifies the URL of the document that contained the link that referred to the current document.
A read-only string that specifies the <TITLE> of the document.
A read-only string that specifies the URL of the document.
A string that specifies the color of visited links. May be set in the document <HEAD> or through the VLINK <BODY> attribute.
A method that erases the contents of the document. This method is deprecated in Navigator 3.0.
A method that closes a document stream opened with the open() method.
A method that opens a stream to which document contents may be written.
A method that inserts the specified string or strings into the document currently being parsed, or into a document stream opened with open().
A method identical to write(), except that it appends a newline character to the output.
An event handler invoked when the document is fully loaded, specified by the onLoad attribute of <BODY>. Although this event handler is specified as an attribute of the <BODY> tag, it is a property of the Window object, not the Document object. See "Window.onload()" for details.
An event handler invoked when the document is unloaded, specified by the onUnload attribute of <BODY>. Although this event handler is specified as an attribute of the <BODY> tag, it is a property of the Window object, not the Document object. See "Window.onunload()" for details.
The Document object obtains values for a number of its properties from attributes of the HTML <BODY> tag. Also, the HTML contents of a document appear within the <BODY> and </BODY> tags.
<BODY [ BACKGROUND="imageURL" ] a background image for the document [ BGCOLOR="color" ] a background color for the document [ TEXT="color" ] the foreground color the document's text [ LINK="color" ] the color for unvisited links [ ALINK="color" ] the color for activated links [ VLINK="color" ] the color for visited links [ onLoad="handler" ] JavaScript to run when the document is loaded [ onUnload="handler" ] JavaScript to run when the document is unloaded > HTML document contents go here. </BODY>
The Document object represents the HTML document displayed in a browser window or frame. The properties of this object provide details about many aspects of the document, from the colors of the text, background, and anchors, to the date on which the document was last modified. The Document object also contains a number of arrays that describe the contents of the document. The links[] array contains one Link object for each hypertext link in the document. Similarly, the applets[] array contains one object for each Java applet embedded in the document, and the forms[] array contains one Form object for each HTML form that appears in the document.
The write() method of the Document object is especially notable. When invoked in scripts that are run while the document is loading, you can call document.write() to insert dynamically generated HTML text into the document.
See Chapter 14, Documents and Their Contents, for an overview of the Document object, and of many of the other JavaScript objects that it refers to. See the individual reference pages for full documentation for each of the properties and methods of this object.