Latest web development tutorials

HTML DOM Area shape 屬性

Area 對象參考手冊 Area對象

定義和用法

shape 屬性可設置或返回某個區域的shape 屬性值。

shape 屬性指定了圖像映射中某個區域的形狀。

語法

areaObject.shape=value

shape 屬性可以是以下值:

描述
default 指定整个地区
rect 定义了一个矩形区域
circle 定义了一个圆形区域
poly 定义一个多边形区域


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持shape 屬性


實例

實例

下面的例子可返回圖像映射中"Venus" 區域的形狀:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.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

嘗試一下»


Area 對象參考手冊 Area對象