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
Release: 2023-08-26 16:37:06
forward
662 people have browsed it

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>
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template