Collection of HTML elements.
Platform Support
| IE | Mozilla | Netscape | Opera | Safari | no | 1.0+ | 6.0+ | 7.0+ | no |
|---|
Constructors
| Constructor | Action | IE | Mozilla | Netscape | Opera | Safari | ||
|---|---|---|---|---|---|---|---|---|
|
HTMLCollection Constructor() : HTMLCollection
Collection of HTML elements.
|
Show Details | no | 1.0+ | 6.0+ | 7.0+ | no | ||
HTMLCollection() : HTMLCollectionCollection of HTML elements. Returns
|
||||||||
Properties
| Property | Action | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|---|
|
length
: Number
Number of elements in the collection.
|
Show Details | no | 1.0+ | 6.0+ | 7.0+ | no |
|
||||||
Functions
| Method | Action | IE | Mozilla | Netscape | Opera | Safari | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
static item(Number index) : Node
Returns the element found at the specified position in the collection.
|
Show Details | no | 1.0+ | 6.0+ | 7.0+ | no | |||||
|
Parameters
Returns
|
|||||||||||
|
static namedItem(String name) : Node
Returns the element with the specified Id.
|
Show Details | ||||||||||
|
Parameters
Returns
|
|||||||||||
Remarks
Use the item method to return an element by index position. Use the namedItem method to return an
element by its name.
References
Availability
HTML DOM Level 2|W3C
