children | NN n/a IE 4 DOM n/a | |||
A collection of all elements contained in the current element. Note that unlike the childNodes collection, children counts only elements and not text nodes. Collection members are sorted in source code order. Internet Explorer lets you use array notation or parentheses to access a single element in the collection. |
||||
Object Model Reference | ||||
document.getElementById("elementID").children(i) document.getElementById("elementID").children[i] |
||||
Object-Specific Properties | ||||
|
||||
Object-Specific Methods | ||||
|
||||
Object-Specific Event Handler Properties | ||||
None. |
children[ ] | NN n/a IE 4 DOM n/a |
Read-only | |
Returns an array of all first-level HTML element objects contained by the current element. This collection differs from the all[ ] collection in that it contains references only to the immediate children of the current element (whereas the all[ ] collection transcends generations). For example, document.body.children[ ] might contain a form, but no reference to form elements nested inside the form. Items in this array are indexed (zero-based) in source code order. In contrast to the childNodes[ ] array, the scope of this property is the element, not the node. See the children object. |
|
Example | |
for (var i = 0; i < elementRef.children.length; i++) { if (elementRef.children[i].tagName == "FORM") { // operate on a form element } } |
|
Value | |
Array of element object references. |
|
Default | |
Array of length zero. |
length | NN n/a IE 4 DOM n/a |
Read-only | |
Returns the number of elements in the collection. |
|
Example | |
var howMany = document.body.children.length; |
|
Value | |
Integer. |
item( ) | NN n/a IE 4 DOM n/a |
item(index) | |
Returns an element object corresponding to the element matching the index value in source code order. |
|
Parameters | |
|
|
Returned Value | |
Reference to an element object. If there is no matches to the parameter, the returned value is null. |
namedItem( ) | NN n/a IE 6 DOM n/a |
namedItem(IDOrName) | |
Returns an element object or collection of objects corresponding to the element matching the parameter string value. |
|
Parameters | |
|
|
Returned Value | |
One element object or collection (array) of element objects. If there are no matches to the parameters, the returned value is null. |
urns( ) | NN n/a IE 5(Win) DOM n/a |
urns(URN) | |
See the all.urns( ) method. |