PHP前端开发

如何使用JavaScript获取图像的usemap属性的值?

百变鹏仔 3个月前 (09-22) #HTML
文章标签 如何使用

要获取图像的 usemap 属性值,请使用 useMap 属性。您可以尝试运行以下代码来显示 usemap 属性值 -

示例

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