Javascript DOM HTML Image isMap Property set

Introduction

Set the isMap property:

document.getElementById("myImg").isMap = true;

Click button to specify that the image should be part of a server-side image-map.

View in separate window

<!DOCTYPE html>
<html>
<body>

<a href="/action_page.php">
  <img id="myImg" src="image1.png" alt="java2s.com" width="100" height="100">
</a>/*w  w  w. j  a  va 2  s. c om*/
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {
  document.getElementById("myImg").isMap = true;
  document.getElementById("demo").innerHTML = "The image is now part of a server-side image-map.";
}
</script>

</body>
</html>



PreviousNext

Related