Home >Web Front-end >HTML Tutorial >How to get the value of an image's usemap attribute using JavaScript?

How to get the value of an image's usemap attribute using JavaScript?

PHPz
PHPzforward
2023-08-26 16:37:06639browse

How to get the value of an images usemap attribute using JavaScript?

#To get the usemap attribute value of an image, use the useMap attribute. You can try running the following code to display the usemap attribute value -

Example

<!DOCTYPE html>
<html>
   <body>
      <img id = "myid" src = "/images/html.gif" alt = "HTML Map" usemap = "#html"/>
      <map name = "html">
         <area id = "myarea" shape = "circle" coords = "154,150,59" href = "about.htm" alt = "Team" >
      </map>
      <script>
         var x = document.getElementById("myid").useMap;
         document.write("<br>Usemap: "+x);
      </script>
   </body>
</html>

The above is the detailed content of How to get the value of an image's usemap attribute using JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete