Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Map name Property

Map name Property

Map Object Reference Map object

Example

Get the name of the image map:

var x = document.getElementById("planetmap").name;

x Output value:

planetmap

Try it »


Definition and usage

The name property sets or returns the value of the name attribute of the image map.

The name property describes the name of the image map.

The name property is associated with the usemap attribute of the tag, to create the relationship between the image and the map.

Note: When the name property is set, you also need to set 's usemap attribute - if not set, the image and map elements are no longer associated (the clickable areas will no longer be clickable).

Note: In HTML5, the id attribute and name attribute values of the element must be the same (but cannot be null or empty).


Browser support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the name attribute.


Syntax

Return the name attribute:

mapObject

.name

Set the name attribute:

mapObject

.name=

name

Attribute values

Value Description
name Specify the name of the image map

Technical description

Return value: String, representing the name of the image map

More examples

Example

Modify the name of the image map:

document.getElementById("planetmap").name = "newMapName";

Try it »


Related pages

HTML Reference Manual: HTML name attribute


Map Object Reference Map object