HomeLanguagesJavascriptHTML DOM Object useMap Property

HTML DOM Object useMap Property

The HTML DOM Object useMap Property is used to set or return the value of the usemap attribute of an <object> element. The <object> usemap attribute is used to specify the name of an image-map to use with the object. The image with clickable areas is called an image map. The useMap attribute is related to the association with the <map> element’s name attribute and creates a relationship between the object and map. 

Syntax

  • It is used to return the useMap Property.
objObject.useMap
  • It is used to set the useMap Property.
objObject.useMap = #mapname

Property Values 

  • #mapname: It is used to hold the map name containing the hash (#) character.

Return Values: It returns a string value that represents the value of the usemap attribute of an <object> element if it contains the hash character (“#”).

 

Example 1: The below code returns a useMap property.

HTML




<!DOCTYPE html>
<html>
  
<body style="text-align: center">
    <h2>neveropen</h2>
    <h2>HTML Dom Object useMap Property</h2>
    <object id="myneveropen" data=
        usemap="#Geeks1">
    </object>
      
    <button onclick="GFG()">
        Click Here!
    </button>
      
    <map name="Geeks1">
        <area id="Geeks" shape="rect" 
            coords="0, 0, 110, 100" alt="Geeks">
    </map>
  
    <p id="GEEK!"></p>
  
    <script>
        function GFG() {
  
            // Return value of usemap attribute
            var x = document.getElementById("myneveropen").useMap;
            document.getElementById("GEEK!").innerHTML = x;
        }
    </script>
</body>
  
</html>


Output:

Supported Browsers:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari
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

4 COMMENTS

Most Popular

Dominic
32705 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7076 POSTS0 COMMENTS
Nicole Veronica
12212 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12303 POSTS0 COMMENTS
Shaida Kate Naidoo
7198 POSTS0 COMMENTS
Ted Musemwa
7457 POSTS0 COMMENTS
Thapelo Manthata
7175 POSTS0 COMMENTS
Umr Jansen
7162 POSTS0 COMMENTS