如何用 JavaScript 獲取影像的 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>

更新於: 2020 年 6 月 23 日

140 條瀏覽

開啟你的 職業生涯

完成課程認證

開始使用
廣告
© . All rights reserved.