mozilla
Your Search Results

    Document.images

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

    Syntax

    var htmlCollection = document.images;

    Example

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

    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.

    Specification

    Document Tags and Contributors

    Last updated by: teoli,