Availability
DOM Level 1 HTML
Synopsis
Node item(unsigned long index);
Arguments
index
The position of the element to be returned. Elements appear in an
HTMLCollection in the same order in which they appear in the document
source.
Returns
The element at the specified index, or
null if index is less
than zero or greater than or equal to the length
property.
Description
The item( ) method returns a numbered element from
an HTMLCollection. In JavaScript, it is easier to treat the
HTMLCollection as an array and to index it using array notation.
Example
var c = document.images; // This is an HTMLCollection
var img0 = c.item(0); // You can use the item( ) method this way
var img1 = c[1]; // But this notation is easier and more common
See Also
NodeList.item( )
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.