Find out if an image is part of a server-side image-map:
var x = document.getElementById("myImg").isMap;
Click button below to find out if the image is part of a server-side image-map.
<!DOCTYPE html> <html> <body> <a href="/action_page.php"> <img id="myImg" src="image1.png" alt="java2s.com" width="100" height="100" ismap> </a>/* ww w. j a v a2 s . co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myImg").isMap; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The isMap
property sets or gets whether an image is part of a server-side image-map.
This property mirrors the HTML ismap attribute.
The isMap
property accepts and returns a boolean type value.
Value | Description |
---|---|
true | The image will be part of a server-side image-map |
false | The image will NOT be part of a server-side image-map |
The isMap
property returns true if the image is part of a server-side image-map, otherwise it returns false.