Search w3schools.com:

SHARE THIS PAGE

Image useMap Property

Image Object Reference Image Object

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.

Syntax

imageObject.useMap=value

The useMap property can have the following value:

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


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The useMap property is supported in all major browsers.


Example

Example

Return the value of the usemap attribute of a client-side image-map:

<html>
<body>

<img id="planets" src="planets.gif"
width="145" height="126"
usemap="#planetmap">

<map name="planetmap">
<area id="venus" shape="circle"
coords="124,58,8"
alt="The planet Venus"
href="venus.htm">
</map>

<p>The value of the usemap attribute is:
<script>
document.write(document.getElementById("planets").useMap);
</script>
</p>

</body>
</html>

Try it yourself »


Image Object Reference Image Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]