Edit This Code:
<!DOCTYPE html>
<html>
<body>

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

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

<p id="demo">It is not possible to click on the "venus" area in the image-map, because the the image does not have a usemap.</p>

<p>Click the button to set the value of the usemap attribute of the image to "#planetmap".</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    var x = document.getElementById("planets").useMap = "#planetmap";
    document.getElementById("demo").innerHTML = "The usemap is set, and the venus link now works!";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy