HTMLDocument : Document
Return to: HTML DOM Level 2 index

HTML Document object.

Platform Support

IE Mozilla Netscape Opera Safari
3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Constructors

Constructor Action IE Mozilla Netscape Opera Safari
HTMLDocument Constructor() : HTMLDocument
HTML Document object.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

HTMLDocument() : HTMLDocument

HTML Document object.

Returns
HTMLDocument

Visibility
internal

Properties

Property Action IE Mozilla Netscape Opera Safari
anchors : HTMLCollection
Array of all of the anchors in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

applets : HTMLCollection
Array of all of the applets in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

body : HTMLElement
Reference to the HTMLBodyElement for the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/document.html

Availability

HTML DOM Level 2|W3C

cookie : String
Cookies for the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

domain : String
Name of the domain that the document was loaded from.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

forms : HTMLCollection
Array of all of the forms (HTMLFormElement) in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

images : HTMLCollection
Array of all of the images in the document.
Show Details 4.0+ 1.0+ 3.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

links : HTMLCollection
Array of all of the links in the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

referrer : String
URL of the document that linked to this document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

title : String
Title of the document. (Contents of the title tag.)
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/innerhtml.html

Availability

HTML DOM Level 2|W3C

URL : String
URL of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+
Availability

HTML DOM Level 2|W3C

Functions

Method Action IE Mozilla Netscape Opera Safari
close() : void
Closes the output stream to the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Returns
void

See Also

HTMLDocument.open|Document.close

Availability

HTML DOM Level 2|W3C

static getElementsByName(String elementName) : NodeList
Returns an array of all of the elements in the document with the specified name.
Show Details 5.0+ 1.0+ 2.0+ 7.0+ 1.0+
  • IE: Only returns matching img and input elements.
  • Opera: Only returns matching img and input elements.

Parameters
String elementName Name of the element.

Returns
NodeList

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/named.html

See Also

Document.getElementById|Document.getElementsByTagName

Availability

HTML DOM Level 2|W3C

open() : void
Opens an output stream for the document so that the document may be written to.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Returns
void

See Also

HTMLDocument.close|HTMLDocument.write|Document.open

Availability

HTML DOM Level 2|W3C

write(String text) : void
Appends a line of text to the end of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters
String text Text string to write.

Returns
void

See Also

HTMLDocument.open|Document.write

Availability

HTML DOM Level 2|W3C

writeln(String text) : void
Appends a line of text, followed by a newline character, to the end of the document.
Show Details 3.0+ 1.0+ 2.0+ 7.0+ 1.0+

Parameters
String text Text string to write.

Returns
void

See Also

Document.writeln

Availability

HTML DOM Level 2|W3C

References

Document.getElementById|HTMLBodyElement|Document

Availability

HTML DOM Level 2|W3C

text_javascript aptana_docs