Tuesday, November 19, 2024
Google search engine
HomeLanguagesJavascriptHTML DOM Image isMap Property

HTML DOM Image isMap Property

The HTML DOM Image isMap Property is used to set or return whether the image is a component of a server-side image map. An image map is a picture with clickable areas. When clicking on a server-side image-map, the press coordinates square measure sent to the server as a URL query string. 

Note: This attribute is permitted only if the <img> element is a child of an <a> element with a proper href attribute.

Syntax

  • It is used to return the isMap Property.
imageObject.isMap
  • It is used to set the isMap Property.
imageObject.isMap = true|false

Property Values: It contains a Boolean value which defines whether the image is a component of the server side image-map. 

  • true: It defines that image is a part of a server side image map.
  • false: It defines that image is not a part of a server side image map.

Return Values : It returns a Boolean value which represents that whether the image is a component of a server side image map. 

Example 1: Below code returns the isMap Property.

HTML




<!DOCTYPE html>
<html>
  <body>
    <center>
      <h1 style="color: green">neveropen</h1>
      <h2>HTML DOM Image isMap Property</h2>
      <a href="#">
        <img
          id="GFG"
          src=
          width="400"
          height="150"
          ismap
        />
      </a>
      <button onclick="Geeks()">Click me!</button>
      <p id="sudo"></p>
 
    </center>
 
    <script>
      function Geeks() {
        var g = document.getElementById("GFG").isMap;
        document.getElementById("sudo").innerHTML = g;
      }
    </script>
  </body>
</html>


Output

Example 2:Below code sets the isMap property to false.

HTML




<!DOCTYPE html>
<html>
  <body>
    <center>
      <h1 style="color: green">neveropen</h1>
      <h2>HTML DOM Image isMap Property</h2>
      <a href="#">
        <img
          id="GFG"
          src=
          width="400"
          height="150"
          ismap
        />
      </a>
      <button onclick="Geeks()">Click me!</button>
      <p id="sudo"></p>
 
    </center>
 
    <script>
      function Geeks() {
        var g = (document.getElementById("GFG").isMap = false);
        document.getElementById("sudo").innerHTML =
          "Now the ismap attribute is set to:" + g;
      }
    </script>
  </body>
</html>


Output:

Supported Browsers

  • Google Chrome
  • Internet Explorer
  • Opera
  • Safari
  • Firefox
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments