Area altProperty

Area 对象参考手册Area Object

Definition and Usage

The alt property returns or sets the value of the alt attribute of an area.

The alt attribute can specify the alternative text to be displayed when the browser cannot display the area.

Syntax

areaObject.alt=alternate_text


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the alt attribute.


Example

Example

The following example returns the alternative text of the "Venus" area in the image map:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
</head>
<body>

<img src="planets.gif.html" width="145" height="126" usemap="#planetmap">
<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm.html">
</map>
<p>Venus's alternative text:
<script>
document.write(document.getElementById("venus").alt);
</script>
</p>

</body>
</html>

The output of the above example is:

The alternative text of Venus: Venus

Try it yourself »


Area 对象参考手册Area Object Other Extensions