DOM Node List
The getElementsByTagName method returns a node-list.
A node-list is an array of nodes.
The code on the right selects all <p> nodes in a node-list.
The index starts at 0.
|
|
DOM Node List Length
The length property defines the number of nodes in a node-list.
You can loop through a node-list by using the length property.
The example performs the following two tasks:
|
|
Tragedy is when I cut my finger. Comedy is when you fall into an open sewer and die. — Mel Brooks on the difference between comedy and tragedy |