Object useMap Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Object


The useMap property sets or gets the usemap attribute of an <object> element.

Set the useMap property with the following Values

#mapname Sets a hash character ("#") plus the name of the map element to use

Return Value

A String, representing the name of the image-map that is used with the object

The following code shows how to get the name of the image-map that is used with the object:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<object id="myObject" data="http://java2s.com/resources/a.png" width="145" height="126" usemap="#myMap"></object>

<map name="myMap">
  <area shape="rect" coords="0,0,82,126" alt="rect" href="http://java2s.com">
  <area shape="circle" coords="90,60,5" alt="circle1" href="http://java2s.com">
  <area shape="circle" coords="125,60,10" alt="circle2" href="http://java2s.com">
</map>//from   w  w w.  j  av a 2s . c o m

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

function myFunction() {
    var x = document.getElementById("myObject").useMap;
    document.getElementById("demo").innerHTML = x;


Related Tutorials