HTML DOM Image useMap Property
THE WORLD'S LARGEST WEB DEVELOPER SITE

Image useMap Property

❮ Image Object

Example

Set the useMap property:

document.getElementById("planets").useMap = "#planetmap";
Try it Yourself »

Definition and Usage

The useMap property sets or returns the value of the usemap attribute of an image.

The usemap attribute specifies an image as a client-side image-map (an image-map is an image with clickable areas).

The usemap attribute is associated with a map element's name attribute, and creates a relationship between the image and the map.


Browser Support

Property
useMap Yes Yes Yes Yes Yes

Syntax

Return the useMap property:

imageObject.useMap

Set the useMap property:

imageObject.useMap = #mapname

Property Values

Value Description
#mapname A hash character ("#") plus the name of the map element to use


Technical Details

Return Value: A String, representing the value of the usemap attribute of the image, including the hash character ("#")

More Examples

Example

Return the value of the usemap attribute of an image:

var x = document.getElementById("planets").useMap;
Try it Yourself »

Related Pages

HTML reference: HTML <img> usemap attribute


❮ Image Object