W3Schools.com

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 type="text/javascript">
document.write(document.getElementById("planets").useMap);
</script>
</p>

</body>
</html>

Try it yourself »


Image Object Reference Image Object
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE