Image useMap Property - Return the value of the usemap attribute of an image: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

Image useMap Property - Return the value of the usemap attribute of an image:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<img id="planets" src="http://java2s.com/resources/a.png" width="145" height="126">

<map name="myMap">
  <area id="myId" shape="circle" coords="125,60,10" alt="alt message" href="http://java2s.com">
</map>//from   w  w w. j a va 2 s  .co m

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

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

<script>
function myFunction() {
    var x = document.getElementById("planets").useMap = "#myMap";
    document.getElementById("demo").innerHTML = "The usemap is set";
}
</script>

</body>
</html>

Related Tutorials