How can I detect the number of images displayed on my HTML page?

Jorge Jordão

The document.images array holds all the images displayed on your page. You can find out how many there are by looking at its length, after the page has been completely loaded (so all images may be accounted for).

  <BODY ONLOAD="alert('Document has ' + 
    document.images.length + ' images.')">
    <!-- put images here -->