TOC PREV NEXT INDEX

domref



childNodes


Returns an array of child nodes on the given element node.

Syntax

children = elementNode.childNodes
 

Parameters

children is a nodeList of children of the document.

Example

// table is an object reference to a table element
 
kids = table.childNodes;
 
for (var i = 0; i < kids.length; i++) {
 
    // do something with each kid as kids[i]
 

 
}
 

Notes

The document object itself has only a single child, and that is the HTML element. Note again that the items in the array are objects and not strings. To get data from those objects you must use their properties (e.g. childNode[2].nodeName to get the name, etc.)

Specification

childNodes


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