Area hrefProperty

Area 对象参考手册Area Object

Definition and Usage

The href property can set or return the value of the href attribute of an area.

The href attribute specifies the target link of an area.

Syntax

areaObject.href=URL


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the href property.


Example

Example

The following example returns the href attribute of the "Venus" area in an 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 href attribute value:
<script>
document.write(document.getElementById("venus").href);
</script>
</p>

</body>
</html>

The output of the above example is:

Venus's href attribute value: http://www.example.com/try/demo_source/venus.htm

Try it yourself »


Area 对象参考手册Area Object Other Extensions