Latest web development tutorials

HTML DOM Area href attribute

Area Object Reference Area objects

Definition and Usage

href property sets or returns the value of a gram of the area href attribute.

href attribute specifies a link to a target area.

grammar

areaObject.href=URL


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support href attribute


Examples

Examples

The following example returns the href attribute 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>金星的href属性值:
<script>
document.write(document.getElementById("venus").href);
</script>
</p>

</body>
</html>

Examples of the above output:

Venus href attribute value: http://www.w3big.com/try/demo_source/venus.htm

try it"


Area Object Reference Area objects