Latest web development tutorials

HTML DOM Map name attribute

Map Object Reference Map Object

Examples

Get the name of the map image:

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

x output values:

planetmap

try it"

Definitions and use

name or name attribute is used to set the property values ​​return to the image map.

name attribute describes the name of the map image.

usemap name attribute associated with the attribute <img> tag linked to create a relationship between the image and the mapping.

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

Note: In HTML5, <map> id attribute value and attribute name element must be the same (but not be null or empty values).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support name attribute.


grammar

Returns the name attribute:

mapObject .name

Setting name attribute:

mapObject .name = name

Property Value

value description
name Specifies the name of the map image

Technical Description

return value: String representing the name of the map image


More examples

Examples

Modify the image map names:

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

try it"


Related Pages

HTML Reference Manual: HTML <Map> name attribute


Map Object Reference Map Object