HTML DOM Area shape properties
Definition and Usage
shape property sets or returns the shape property values of an area.
shape attribute specifies the shape of the image map of an area.
grammar
areaObject.shape=value
shape attribute can have the following values:
值 | 描述 |
---|---|
default | 指定整个地区 |
rect | 定义了一个矩形区域 |
circle | 定义了一个圆形区域 |
poly | 定义一个多边形区域 |
Browser Support
All major browsers support shape properties
Examples
Examples
The following example returns the shape of the image map "Venus" area:
<!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>
<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>
Examples of the above output:
金星区域的形状: circle
try it"
Area objects