Revision 10455 of Document

  • Revision slug: DOM/document
  • Revision title: document
  • Revision id: 10455
  • Created:
  • Creator: Baris
  • Is current revision? No
  • Comment /* Introduction */

Revision Content

« Gecko DOM Reference


Introduction

In the DOM, the document object provides a general way to represent HTML, XHTML, and XML documents. In addition to the generalized document interface, the APIs listed here include HTMLDocument, which is a more specialized interface for dealing with HTML documents (e.g., document.cookie, document.alinkColor). Interfaces that are part of this more specialized HTML document have asterisks next to them in the table below.

The document is contained by the window object (see window) and may contain any number of elements (see element).

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.

Properties

document.alinkColor*
Returns or sets the color of active links in the document body.
document.anchors*
anchors returns a list of all of the anchors in the document.
document.applets*
applets returns an ordered list of the applets within a document.
document.bgColor*
bgColor gets/sets the background color of the current document.
document.body*
body returns the BODY node of the current document.
document.characterSet
Returns the character set being used by the document.
document.compatMode*
Indicates whether the document is rendered in Quirks or Strict mode.
document.cookie*
Returns a semicolon-separated list of the cookies for that document or sets a single cookie.
document.contentWindow*
Returns the window object for the containing window.
document.doctype
Returns the Document Type Definition (DTD) of the current document.
document.documentElement
Returns the Element that is a direct child of document, which in most cases is the HTML element.
document.domain*
domain returns the domain of the current document.
document.embeds*
embeds returns a list of the embedded OBJECTS within the current document.
document.fgColor*
fgColor gets/sets the foreground color, or text color, of the current document.
document.firstChild
firstChild returns the first node in the list of direct children of the document. (See also firstChild for the general element property.)
document.forms*
formsreturns a list of the FORM elements within the current document.
document.height*
height gets/sets the height of the current document.
document.images*
images returns a list of the images in the current document.
document.implementation*
Returns the DOM implementation associated with the current document.
document.lastModified*
Returns the date on which the document was last modified.
document.linkColor*
Gets/sets the color of hyperlinks in the document.
document.links*
Returns an array of all the hyperlinks in the document.
document.location*
Returns the URI of the current document.
document.namespaceURI
Returns the XML namespace of the current document.
document.plugins*
Returns an array of the available plugins.
document.referrer*
Returns the URI of the page that linked to this page.
document.styleSheets*
The stylesheets property returns a list of the stylesheet objects on the current document.
document.title*
Returns the title of the current document.
document.URL
Returns a string containing the URL of the current document.
document.vlinkColor*
Gets/sets the color of visited hyperlinks.
document.width*
Returns the width of the current document.

Methods

document.clear
Clears a document.
document.close
Closes a document stream for writing.
document.createDocumentFragment
Creates a new document fragment.
document.createElement
Creates a new element.
document.createTextNode
Creates a text node.
document.getElementById
Returns an object reference to the identified element.
document.getElementsByName
Returns a list of elements with the given name.
document.open
Opens a document stream for writing.
document.write
Writes text to a document.
document.writeln
Write a line of text to a document.

Revision Source

<p>
</p><p><a href="en/Gecko_DOM_Reference">« Gecko DOM Reference</a>
</p><p><br>
</p>
<h3 name="Introduction"> Introduction </h3>
<p>In the DOM, the document object provides a general way to represent <a href="en/HTML">HTML</a>, <a href="en/XHTML">XHTML</a>, and <a href="en/XML">XML</a> documents. In addition to the generalized document interface, the APIs listed here include <a href="en/HTMLDocument">HTMLDocument</a>, which is a more specialized interface for dealing with HTML documents (e.g., <a href="en/DOM/document.cookie">document.cookie</a>, <a href="en/DOM/document.alinkColor">document.alinkColor</a>). Interfaces that are part of this more specialized HTML document have asterisks next to them in the table below.
</p><p>The document is contained by the window object (see <a href="en/DOM/window">window</a>) and may contain any number of elements (see <a href="en/DOM/element">element</a>).
</p><p>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 &lt;BODY&gt; element, a &lt;TABLE&gt; and so forth.
</p>
<h3 name="Properties"> Properties </h3>
<dl><dt> <a href="en/DOM/document.alinkColor">document.alinkColor</a>*
</dt><dd> Returns or sets the color of active links in the document body.
</dd></dl>
<dl><dt> <a href="en/DOM/document.anchors">document.anchors</a>*
</dt><dd> <b>anchors</b> returns a list of all of the anchors in the document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.applets">document.applets</a>*
</dt><dd> <b>applets</b> returns an ordered list of the applets within a document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.bgColor">document.bgColor</a>*
</dt><dd> <b>bgColor</b> gets/sets the background color of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.body">document.body</a>*
</dt><dd> <b>body</b> returns the BODY node of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.characterSet">document.characterSet</a>
</dt><dd> Returns the character set being used by the document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.compatMode">document.compatMode</a>*
</dt><dd> Indicates whether the document is rendered in Quirks or Strict mode.
</dd></dl>
<dl><dt> <a href="en/DOM/document.cookie">document.cookie</a>*
</dt><dd> Returns a semicolon-separated list of the cookies for that document or sets a single cookie.
</dd></dl>
<dl><dt> <a href="en/DOM/document.contentWindow">document.contentWindow</a>*
</dt><dd> Returns the window object for the containing window.
</dd></dl>
<dl><dt> <a href="en/DOM/document.doctype">document.doctype</a>
</dt><dd> Returns the Document Type Definition (DTD) of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.documentElement">document.documentElement</a>
</dt><dd> Returns the Element that is a direct child of document, which in most cases is the HTML element.
</dd></dl>
<dl><dt> <a href="en/DOM/document.domain">document.domain</a>*
</dt><dd> <b>domain</b> returns the domain of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.embeds">document.embeds</a>*
</dt><dd> <b>embeds</b> returns a list of the embedded OBJECTS within the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.fgColor">document.fgColor</a>*
</dt><dd> <b>fgColor</b> gets/sets the foreground color, or text color, of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.firstChild">document.firstChild</a>
</dt><dd> <b>firstChild</b> returns the first node in the list of direct children of the document. (See also <a href="en/FirstChild">firstChild</a> for the general element property.)
</dd></dl>
<dl><dt> <a href="en/DOM/document.forms">document.forms</a>*
</dt><dd> <b>forms</b>returns a list of the FORM elements within the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.height">document.height</a>*
</dt><dd> <b>height</b> gets/sets the height of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.images">document.images</a>*
</dt><dd> <b>images</b> returns a list of the images in the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.implementation">document.implementation</a>*
</dt><dd> Returns the DOM implementation associated with the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.lastModified">document.lastModified</a>*
</dt><dd> Returns the date on which the document was last modified.
</dd></dl>
<dl><dt> <a href="en/DOM/document.linkColor">document.linkColor</a>*
</dt><dd> Gets/sets the color of hyperlinks in the document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.links">document.links</a>*
</dt><dd> Returns an array of all the hyperlinks in the document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.location">document.location</a>*
</dt><dd> Returns the URI of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.namespaceURI">document.namespaceURI</a>
</dt><dd> Returns the XML namespace of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.plugins">document.plugins</a>*
</dt><dd> Returns an array of the available plugins.
</dd></dl>
<dl><dt> <a href="en/DOM/document.referrer">document.referrer</a>*
</dt><dd> Returns the URI of the page that linked to this page. 
</dd></dl>
<dl><dt> <a href="en/DOM/document.styleSheets">document.styleSheets</a>*
</dt><dd> The <b>stylesheets</b> property returns a list of the <i>stylesheet</i> objects on the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.title">document.title</a>*
</dt><dd> Returns the title of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.URL">document.URL</a>
</dt><dd> Returns a string containing the URL of the current document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.vlinkColor">document.vlinkColor</a>*
</dt><dd> Gets/sets the color of visited hyperlinks.
</dd></dl>
<dl><dt> <a href="en/DOM/document.width">document.width</a>*
</dt><dd> Returns the width of the current document.
</dd></dl>
<h3 name="Methods"> Methods </h3>
<dl><dt> <a href="en/DOM/document.clear">document.clear</a>
</dt><dd> Clears a document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.close">document.close</a>
</dt><dd> Closes a document stream for writing.
</dd></dl>
<dl><dt> <a href="en/DOM/document.createDocumentFragment">document.createDocumentFragment</a>
</dt><dd> Creates a new document fragment.
</dd></dl>
<dl><dt> <a href="en/DOM/document.createElement">document.createElement</a>
</dt><dd> Creates a new element.
</dd></dl>
<dl><dt> <a href="en/DOM/document.createTextNode">document.createTextNode</a>
</dt><dd> Creates a text node.
</dd></dl>
<dl><dt> <a href="en/DOM/document.getElementById">document.getElementById</a>
</dt><dd> Returns an object reference to the identified element.
</dd></dl>
<dl><dt> <a href="en/DOM/document.getElementsByName">document.getElementsByName</a>
</dt><dd> Returns a list of elements with the given name.
</dd></dl>
<dl><dt> <a href="en/DOM/document.open">document.open</a>
</dt><dd> Opens a document stream for writing.
</dd></dl>
<dl><dt> <a href="en/DOM/document.write">document.write</a>
</dt><dd> Writes text to a document.
</dd></dl>
<dl><dt> <a href="en/DOM/document.writeln">document.writeln</a>
</dt><dd> Write a line of text to a document.
</dd></dl>
Revert to this revision