[Javascript] Listing Images on current page
Nick Fitzsimons
nick at nickfitz.co.uk
Thu Sep 6 10:21:57 CDT 2007
> On 6 Sep 2007, at 15:41, Peter Brunone wrote:
>
> > Now you have an array of all image elements in the page and
> you can
> > loop through it to analyze each element.
>
> If you had 'img' then you would have a collection of the image
> elements, not an array.
To be absolutely strict, you have a NodeList:
<http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#ID-53
6297177>
which, using the ECMAScript binding for DOM Level 1, can be treated as if it
were an array, with the important proviso that any modification to an
element that is a member of that node list, or to its relationship to other
elements, is immediately reflected in the NodeList (that is, the list is
"live":
<http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-core.html#td-li
ve>).
This usually doesn't make any difference, but it can bite one under certain
circumstances.
Regards,
Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/
More information about the Javascript
mailing list