Dom 简明教程

DOM - NodeList Object

NodeList 对象指定已排序节点集合的抽象。NodeList 中的项目可以通过从 0 开始的整数索引访问。

The NodeList object specifies the abstraction of an ordered collection of nodes. The items in the NodeList are accessible via an integral index, starting from 0.

Attributes

下表列出了 NodeList 对象的属性 −

The following table lists the attributes of the NodeList object −

Attribute

Type

Description

length

unsigned long

It gives the number of nodes in the node list.

Methods

以下为 NodeList 对象的唯一方法。

The following is the only method of the NodeList object.

S.No.

Method & Description

1

item()It 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.