Area alt 属性
![Area 对象参考手册](http://static.json.cn/r/uploadfile/up/3e/a9/18/41e5761fb9ace3ecbd611c59b218a93e.jpg)
定义和用法
alt 属性返回可设置某个区域的 alt 属性值。
alt 属性可指定了当浏览器无法显示某个区域时所显示的替换文本。
语法
areaObject.alt=alternate_text
浏览器支持
所有主要浏览器都支持 alt 属性
实例
实例
下面的例子可返回图像映射中 "Venus" 区域的替换文本:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</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="金星" href="venus.htm">
</map>
<p>金星的替代文本:
<script>
document.write(document.getElementById("venus").alt);
</script>
</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</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="金星" href="venus.htm">
</map>
<p>金星的替代文本:
<script>
document.write(document.getElementById("venus").alt);
</script>
</p>
</body>
</html>
以上实例输出结果:
金星的替代文本: 金星
运行代码 »
![Area 对象参考手册](http://static.json.cn/r/uploadfile/up/3e/a9/18/41e5761fb9ace3ecbd611c59b218a93e.jpg)