Map name attribute
Definition and usage
name
Attribute sets or returns the name of the image map. name attribute value.
name
Attribute specifies the name of the image map.
The name attribute is associated with <img> of usemap attribute Associated, and create a relationship between the image and the map.
Note:When setting the name attribute, you should also set the usemap attribute of <img> - if not set, the relationship between the image and the map will no longer exist (the clickable area will no longer be clickable).
Note:In HTML5,<map> The id attribute of the element must be the same as name attribute Have the same value (and cannot be null or empty).
Example
Example 1
Get the name of the image map:
var x = document.getElementById("planetmap").name;
Example 2
Change the name of the image map:
document.getElementById("planetmap").name = "newMapName";
Syntax
Return the name attribute:
anchorObject.name
Set the name attribute:
anchorObject.name = name
Attribute Value
Value | Description |
---|---|
name | Specifies the name of the image map. |
Technical Details
Return Value: | A string value representing the name of the image map. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <map> name Attribute