Image.name (Property)

This corresponds to the NAME attribute of the <IMG> tag.

Availability:

DOM level - 1
JavaScript - 1.1
Netscape - 3.0
Opera - 3.0
Property/method value type:String primitive
JavaScript syntax:NmyImage.name
HTML syntax:<IMG NAME="...">

Objects are identified either by the NAME="..." HTML tag attribute or by the ID="..." HTML tag attribute.

Netscape shows a marginal preference for the name property, while MSIE seems slightly better disposed towards the ID property. However, in many cases both browsers support either technique and in some cases will locate items named with either tag as if they existed in a single namespace.

This property cannot be used with Image objects that are manufactured at run-time from the Image() constructor. They can be collected in an array and accessed associatively as named array elements, but images you create in script aren't part of the document and therefore can't be addressed as if they are.

See also:IMG.name