Visit Mozilla.org

DOM:document.images

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

document.images returns a collection of the images in the current HTML document.

[edit] Syntax

htmlCollection = document.images 

[edit] Example

var ilist = document.images;
for(var i = 0; i < ilist.length; i++) {
    if(ilist[i] == "banner.gif") {
         // found the banner
    }
}

[edit] Notes

document.images.length – property, returns the number of images on the page.

document.images is part of DOM HTML, and it only works for HTML documents.

[edit] Specification

DOM Level 2 HTML: HTMLDocument.images