HTMLDocument |
the root of an HTML document
tree |
Availability
DOM
Level 1 HTML
Inherits from/Overrides
Node Document HTMLDocument
Properties
- readonly HTMLCollection anchors
-
An array (HTMLCollection) of all
anchors in the document. For compatibility with The Level 0 DOM, this
array contains only <a> elements that have a
name attribute specified; it does not include
anchors created with an id attribute.
- readonly HTMLCollection applets
-
An array
(HTMLCollection) of all applets in a document. These include applets
defined with an <object> tag and all
<applet> tags.
- HTMLElement body
-
A convenience
property that refers to the HTMLBodyElement that represents the
<body> tag of this document. For documents
that define framesets, this property refers to the outermost
<frameset> tag.
- String cookie
-
Allows
cookies to be queried and set for this document. See
Document.cookie in the client-side reference section.
- readonly String domain
-
The domain
name of the server from which the document was loaded, or
null if there is none. Contrast with the
read/write Document.domain property in the
client-side reference section.
- readonly HTMLCollection forms
-
An array (HTMLCollection) of all
HTMLFormElement objects in the document.
- readonly HTMLCollection images
-
An array
(HTMLCollection) of all <img> tags in the
document. Note that for compatibility with the Level 0 DOM, images
defined with an <object> tag are not
included in this collection.
- readonly HTMLCollection links
-
An array
(HTMLCollection) of all hyperlinks in the document. These include all
<a> tags that have an
href attribute, and all
<area> tags.
- readonly String referrer
-
The URL of
the document that linked to this document, or null
if this document was not accessed through a hyperlink.
- String title
-
The contents
of the <title> tag for this document.
- readonly String URL
-
The URL of the
document.
Methods
- close( )
-
Closes a document stream opened with the open( )
method, forcing any buffered output to be displayed.
- getElementById( )
-
Returns the element with the specified id. In the
Level 2 DOM, this method is inherited from the Document interface.
- getElementsByName( )
-
Returns an array of nodes (a NodeList) of all elements in the
document that have a specified value for their
name attribute.
- open( )
-
Opens a stream to which new document contents may be written. Note
that this method erases any current document content.
- write( )
-
Appends a string of HTML text to an open document.
- writeln( )
-
Appends a string of HTML text followed by a newline character to an
open document.
Description
This interface extends Document and defines HTML-specific properties
and methods that provide compatibility with the DOM Level 0 Document
object (see the Document object in the client-side reference
section). Note that HTMLDocument does not have all the properties of
the Level 0 Document object. The properties that specify document
colors and background images have been renamed and moved to the
HTMLBodyElement.
Finally, note that in the Level 1 DOM, HTMLDocument defines a method
named getElementById( ). In the Level 2 DOM, this
method has been moved to the Document interface, and it is now
inherited by HTMLDocument rather than defined by it. See the
Document.getElementById( ) entry in this reference
section for details.
See Also
Document.getElementById( ), HTMLBodyElement; Document object in the
client-side reference section
Returned by
HTMLDOMImplementation.createHTMLDocument( )
|