The document Interface
In the DOM, the document object represents the entire HTML or XML document1. It is contained by the window object (see DOM window Reference) and may contain any number of elements (see DOM Element Reference.)
As you can see from the lists below, the interfaces on document deal with such things as the document type, features of the document such as its color and formatting, the plugins and applets that are exposed to the user in the document, as well as methods for creating all of the document's child nodes, or elements that typically live in the structural representation of the whole document, such as the <BODY> element, a <TABLE> and so forth.
Returns an array of attributes on the given element. Returns or sets the color of active links in the document body. anchors returns a list of all of the anchors in the document. applets returns an ordered list of the applets within a document. bgColor gets/sets the background color of the current document. body returns the BODY node of the current document. Returns the character set being used by the document. Returns an array of child nodes on the given element node. Indicates whether the document is rendered in Quirks or Strict mode. Returns a semicolon-separated list of the cookies for that document or sets a single cookie. Returns the window object for the containing window. Returns the Document Type Definition (DTD) of the current document. Returns the Element that is a direct child of document, which in most cases is the HTML element. domain returns the domain of the current document. embeds returns a list of the embedded OBJECTS within the current document. fgColor gets/sets the foreground color, or text color, of the current document. firstChild returns the first node in the list of direct children of the document. forms returns a list of the FORM elements within the current document. height gets/sets the height of the current document. images returns a list of the images in the current document. Returns the DOM implementation associated with the current document. Returns the date on which the document was last modified. Gets/sets the color of hyperlinks in the document. Returns an array of all the hyperlinks in the document. Returns the URI of the current document. Returns the XML namespace of the current document. Returns the node immediately following the current one in the tree. Returns the name of the current node as a string. Returns the node type of the current document. Returns the value of particular types of nodes. Returns an object reference to the document that owns the current element. Returns an object reference to the parent node. Returns an array of the available plugins. Returns the node immediately previous to the current one in the tree. Returns the URI of the page that linked to this page. The stylesheets property returns a list of the stylesheet objects on the current document. Returns the title of the current document. Returns a string containing the URL of the current document. Gets/sets the color of visited hyperlinks. Returns the width of the current document.
Clears a document. Closes a document stream for writing. Create a new attribute on the current element. Creates a new document fragment. Creates a new element. Creates a text node. Returns an object reference to the identified element. Returns a list of elements with the given name. Returns a list of elements with the given tag name. Opens a document stream for writing. Writes text to a document. Write a line of text to a document.
Strictly speaking, the document object represents only HTML and XHTML documents. The XML document is represented by a different document object, XMLDocument, and the XUL document by XULDocument. Though these objects provide very similar interfaces, they are not quite the same as the document object described here.