HTML DOM Area alt attribute
Definition and Usage
alt alt attribute can be set to return to an area of the property value.
alt attribute to specify the replacement text when the browser can not display an area displayed.
grammar
areaObject.alt=alternate_text
Browser Support
All major browsers support the alt attribute
Examples
Examples
The following example returns the replacement text 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="金星" href="venus.htm">
</map>
<p>金星的替代文本:
<script>
document.write(document.getElementById("venus").alt);
</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="金星" href="venus.htm">
</map>
<p>金星的替代文本:
<script>
document.write(document.getElementById("venus").alt);
</script>
</p>
</body>
</html>
Examples of the above output:
金星的替代文本: 金星
try it"
Area objects