imagesNN 3 IE 4 DOM 1  

  

A collection (array) of all img objects contained by the document. This object is implemented only in browser versions that treat images as objects. Therefore, you can use the existence of this array object as a conditional switch surrounding statements that swap or preload images:

if (document.images) {
    // process img element objects here
}

Internet Explorer 3.01 for the Macintosh provided support for images as objects.

 
Object Model Reference
 
document.images
 
Object-Specific Properties
 
length
 
Object-Specific Methods
 
item( )namedItem( )tags( )urns( )
lengthNN 3 IE 4 DOM 1  

Read-only  

Returns the number of elements in the collection.

 
Example
 
var howMany = document.images.length;
 
Value

Integer.

item( )NN 6 IE 4 DOM 1  

item(index[, subindex]) item(index)

  

Returns a single image object or collection of image objects corresponding to the element matching the index value (or, optionally in IE, the index and subindex values).

 
Parameters
 
  • When the parameter is a zero-based integer (required in Netscape 6), the returned value is a single element corresponding to the said numbered item in source code order (nested within the current element). When the parameter is a string, the returned value is a collection of elements with id or name properties that match that string.
  • If you specify a string value for the first parameter (IE only), you may use the second parameter to specify a zero-based integer to retrieve a specific element from the collection with id or name properties that match the first parameter's string value.
 
Returned Value

One object or collection (array) of objects. If there are no matches to the parameters, the returned value is null.

namedItem( )NN 6 IE 6 DOM 2  

namedItem(IDOrName)

  

Returns a single object corresponding to the element matching the parameter string value.

 
Parameters
 
IDOrName

The string that contains the same value as the desired element's id or name attribute.

 
Returned Value

One object reference. If there are no matches to the parameters, the returned value is null.

tags( )NN n/a IE 4 DOM n/a  

tags(tagName)

  

Returns a collection of objects (among all objects within the current collection) with tags that match the tagName parameter. Redundant here, because all elements have the same img tag.

 
Parameters
 
  • A string that contains the element tag, as in document.images.tags("img").
 
Returned Value

A collection (array) of objects. If there are no matches to the parameters, the returned value is an array of zero length.

urns( )NN n/a IE 5(Win) DOM n/a  

urns(URN)

  

Returns a collection of nested element objects that have behaviors attached to them and URNs that match the URN parameter.

 
Parameters
 
  • A string with a local or external behavior file URN.
 
Returned Value

A collection (array) of objects. If there are no matches to the parameters, the returned value is an array of zero length.