Area targetProperty

Area 对象参考手册Area Object

Definition and Usage

The target property can set or return the value of the target attribute in the area.

Syntax

areaObject.target=value

The target attribute can be the following values:

Value Description
_blank Loads the document in a new, unnamed window.
_self Loads the target document in the same frame or window.
_parent Loads the document into the parent window or the frameset that contains the frame with the hyperlink reference.
_top Loads the document into the window that contains the hyperlink, replacing any frames currently displayed in the window.
framename Loads the document in a frame with the same name.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the target attribute.


Example

Example

The following example can return the target property 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" target="_blank">
</map>
<p>The value of the taget attribute in the "Venus" region is:
<script>
document.write(document.getElementById("venus").target);
</script>
</p>

</body>
</html>

The output of the above example is:

The value of the taget attribute of the "Venus" area is: _blank

Try it »


Area 对象参考手册Area Object Other Extensions