Easy Tutorial
❮ Prop Table Summary Prop Element Clientheight ❯

Map name Attribute

Map Object

Example

Get the name of the image map:

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

x output value is:

planetmap

Definition and Usage

The name attribute is used to set or return the value of the image map's name attribute.

The name attribute describes the name of the image map.

The name attribute is associated with the <img> tag's usemap attribute to create a relationship between the image and the map.

Note: When setting the name attribute, you also need to set the <img>'s usemap attribute - if not set,

the image and map elements are no longer associated (clickable areas will no longer be clickable).

Note: In HTML5, the <map> element's id attribute must be the same as the name attribute's value (but not allowed to be null or empty).


Browser Support

All major browsers support the name attribute.


Syntax

Return the name attribute:

Set the name attribute:

Attribute Values

Value Description
name Specifies 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";

Related Pages

HTML Reference: HTML <map> name Attribute


Map Object

❮ Prop Table Summary Prop Element Clientheight ❯