Area shape 屬性

定義和用法
shape 屬性可設置或返回某個區域的 shape 屬性值。
shape 屬性指定了圖像映射中某個區域的形狀。
語法
areaObject.shape=value
shape 屬性可以是以下值:
值 | 描述 |
---|---|
default | 指定整個地區 |
rect | 定義了一個矩形區域 |
circle | 定義了一個圓形區域 |
poly | 定義一個多邊形區域 |
流覽器支持
所有主要流覽器都支持 shape 屬性
實例
實例
下麵的例子可返回圖像映射中 "Venus" 區域的形狀:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
</head>
<body>
<img src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>金星區域的形狀:
<script>
document.write(document.getElementById("venus").shape);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
</head>
<body>
<img src="planets.gif" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
<p>金星區域的形狀:
<script>
document.write(document.getElementById("venus").shape);
</script>
</p>
</body>
</html>
以上實例輸出結果:
金星區域的形狀: circle
