Image isMap Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image

Description

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
  • 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

Return Value

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:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials