The item Method


The item Method

The item method gives you another way to access objects in a collectionyou can use this method rather than an array index. You can see the support for this method in Table 6.32.

Table 6.32. The item Method

Method

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

item(number [, index])

     

x

   

x

x

x

x

 

Returns: Object

item(text [, index])

     

x

   

x

x

x

x

 

Returns: Object

Here are two ways to access the same node:

 document.getElementById("span1").childNodes.item(5)  document.getElementById("span1").childNodes[5] 

Tip

In the Internet Explorer, you also can use an item's ID value as the array index, or to access the item with the item method.




Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net