TOC PREV NEXT INDEX

domref



documentElement


Returns the Element that is a direct child of document, which in most cases is the HTML element.

Syntax

doc = document.documentElement
 

Parameters

doc is a node representing the direct child of document.

Example

actual_doc = document.documentElement;
 
first_tier = actual_doc.childNodes;
 
// first_tier are the direct children of HTML
 
for (var i = 0; i < first_tier.length; i++) {
 
   // do something with each kid of HTML
 
   // as first_tier[i]
 
}
 

Notes

This property is a read-only convenience for getting the HTML element associated with all valid HTML documents. The example above is quite typical: you actually want the HTML element so you can access all of its children, and so you use this document property to get a hold of it.

Note that document itself typically contains a single child node, HTML, which itself contains all of the elements in the actual HTML document as a nodeList of children.

Specification

documentElement


Netscape Communications
http://developer.netscape.com
TOC PREV NEXT INDEX