document.images

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax

document.images
document.images[index]

Description

The images property is an array that contains all the objects that appear within the HTML document from using the <img> tag. The images property has one property of its own, called length, which contains the number of items in the array. The index number ranges from zero to the length of the array minus 1.

Example

The code in Listing 7.138 accesses the source of each image using the images[] array.

Listing 7.138 Accessing Images with images Array
 <html> <h2>A Circle</h2> <img src="circle.gif"> <h2>A Square</h2> <img src="square.gif"><br> <script language="JavaScript"> <!--Hide //Display the source of the image ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.