XML DOM HTMLDocument Object

The HTMLDocument object represents the root of the HTML document tree.

HTMLDocument object

The HTMLDocument interface provides access to the HTML hierarchy.

The HTMLDocument interface extends the DOM Document interface, defining HTML-specific properties and methods.

Many properties and methods are HTMLCollection objects (actually read-only arrays that can be accessed by array or name index), which store references to anchors, forms, links, and other scriptable elements.

These collection properties all originate from 0-level DOM. They have been Document.getElementsByTagName() has been replaced, but is still often used because they are very convenient.

write() methodIt is noteworthy that during the loading and parsing of the document, it allows a script to insert dynamically generated content into the document.

Note:In 1st level DOM, HTMLDocument defines a method named getElementById() A very useful method. In 2nd level DOM, this method has been moved to the Document interface, and it is now inherited by HTMLDocument instead of being defined by it.

How to get more detailed information about the HTMLDocument object

In the HTML DOM reference manual of CodeW3C.com, we have created a special reference page for the HTMLDocument object:

HTML DOM Document object

Related pages

XML DOM Reference Manual:Document object

XML DOM Reference Manual:Document.getElementById()

XML DOM Reference Manual:Document.getElementsByTagName()