THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Image useMap Property

Image Object Reference 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

Internet Explorer Firefox Opera Google Chrome Safari

The useMap property is supported in all major browsers.


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;

The result of x will be:

#planetmap
Try it yourself »

Related Pages

HTML reference: HTML <img> usemap attribute


Image Object Reference Image Object