TOC PREV NEXT INDEX

Put your logo here!


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

core


mozilla.org | mailto:oeschger | bug 93108
TOC PREV NEXT INDEX