Map name Property
Example
Get the name of an image-map:
The result of x will be:
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
Property | |||||
---|---|---|---|---|---|
name | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the name property:
Set the name property:
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:
Related Pages
HTML reference: HTML <map> name attribute
Map Object