You are here: irt.org | FAQ | JavaScript | Image | Q24 [ previous next ]
There is a simple answer to this question. However it does not always return the answer you would expect.
Since the introduction of JavaScript 1.1 the images object array has become supported. This is an array of all the images in the current document. One of its properties length tells you the number of images within the current document, e.g.
<script language="JavaScript1.1"><!-- document.write(document.images.length); //--></script>
This figure may however be distorted by image swapping, multiple uses of the same image and images within tables.
But used as a simple count it is quite effective.