OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

org.w3c.dom.core
Class NodeList

org.ecmascript.object.Object
   |
   +--org.w3c.dom.core.NodeList

public abstract class NodeList
extends Object
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.

The items in the NodeList are accessible via an integral index, starting from 0.

Note that this object is implemented and supported by the web browser and results of its use may vary.



Field Summary

public Number
length
The number of nodes in this map.


Fields inherited from org.ecmascript.object.Object

constructor, prototype


Method Summary

public Node
item(Number index)
Returns the indexth item in the collection.


Field Detail


length

public Number length

The number of nodes in this map. The range of valid child node indices is 0 to length-1 inclusive.

This is a readonly attribute.

Example:
<div id="doc">
<div>
Text in the first DIV.
</div>
<div id="DDD" class="secondClass">
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span id="SSS">element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:

var main = document.getElementById('doc');
var collection = main.getElementsByTagName('DIV');
var output = collection.length;

Method Detail


item

public Node item(Number index)

Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.

Example:
<div >
<div>
Text in the first DIV.
</div>
<div >
Some text in the second DIV.
</div>
<div class="thirdClass">
Some text and <span >element</span> in the third DIV.
</div>
<div class="fourthClass">
We can try <i>another elements</i>.
It will be much more <b>interesting</b>.
</div>
<div>
Text in the last DIV.
</div>
</div>
JavaScript:

var main = document.getElementById('doc');
var collection = main.getElementsByTagName('DIV');
var output1 = collection.item(2).firstChild.nodeValue;
var output2 = collection[2].firstChild.nodeValue;

Parameters:
index  -  The Index into this map.
Return:
Node - The node at the indexth position in the NamedNodeMap, or null if that is not a valid index.

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Generated on 2011.04.27 02:28 UTC
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.