Javascript examples for DOM HTML Element:Image
The isMap property sets or gets whether an image should be part of a server-side image-map.
This property reflects the HTML ismap attribute.
Set the isMap property with the following Values
Value | Description |
---|---|
true|false | Sets whether the image should be part of a server-side image-map |
A Boolean, returns true if the image is part of a server-side image-map, otherwise it returns false
The following code shows how to check if an image is part of a server-side image-map:
<!DOCTYPE html> <html> <body> <a href="#"> <img id="myImg" src="http://java2s.com/resources/a.png" alt="java2s.com" width="100" height="132"> </a>//from www. ja v a 2s . c om <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var v = document.getElementById("myImg").isMap; document.getElementById("demo").innerHTML = v; } </script> </body> </html>