Image useMap 屬性

定義和用法
useMap 屬性可設置或者返回圖片的 usemap 屬性的值。
usemap 屬性指定了一個圖片的客戶端圖像映射 (一個可點擊區域的圖片映射)。
usemap屬性與map元素名稱的屬性相關,兩者可以 創建圖像和地圖之間的關聯。
語法
imageObject.useMap=value
useMap 屬性可以是以下值:
值 | 描述 |
---|---|
#mapname | 一個哈希字元("#")加上map元素的名稱 |
流覽器支持
所有主要流覽器都支持 useMap 屬性
實例
實例
返回客戶端圖片映射的usemap屬性值:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
</head>
<body>
<img id="planets" src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="The planet Venus" href="venus.htm">
</map>
<p>usemap屬性的值:
<script>
document.write(document.getElementById("planets").useMap);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
</head>
<body>
<img id="planets" src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="The planet Venus" href="venus.htm">
</map>
<p>usemap屬性的值:
<script>
document.write(document.getElementById("planets").useMap);
</script>
</p>
</body>
</html>
