X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Map name Property

Map Object Reference Map Object

Example

Get the name of an image-map:

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

The result of x will be:

planetmap

Try it yourself »


Definition and Usage

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

The name attribute specifies the name of an image-map.

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

Note: When setting the name property, you should also set the <img>'s usemap attribute - if not, the relationship between the image and the map will no longer exist (clickable areas will no longer be clickable).

Note: In HTML5, the id attribute of the <map> element must have the same value as the name attribute (and it cannot be null or empty).


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The name property is supported in all major browsers.


Syntax

Return the name property:

mapObject.name

Set the name property:

mapObject.name=name

Property Values

Value Description
name Specifies the name of an image-map

Technical Details

Return Value: A String, representing the name of the image-map


More Examples

Example

Change the name of an image-map:

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

Try it yourself »


Related Pages

HTML reference: HTML <map> name attribute


Map Object Reference Map Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook