Get the name of an image-map:
The result of x will be:
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).
The name property is supported in all major browsers.
Return the name property:
Set the name property:
Value | Description |
---|---|
name | Specifies the name of an image-map |
Return Value: | A String, representing the name of the image-map |
---|
Change the name of an image-map:
HTML reference: HTML <map> name attribute