HTML DOM target 属性
定义和用法
target 属性可设置或返回在何处打开区域中的 link-URL。
语法
areaObject.target=_blank|_parent|_self|_top
四个保留的目标名称:
- _blank - 在一个新的未命名的窗口载入文档
- _self - 在相同的框架或窗口中载入目标文档
- _parent - 把文档载入父窗口或包含了超链接引用的框架的框架集
- _top - 把文档载入包含该超链接的窗口,取代任何当前正在窗口中显示的框架
实例
The following example changes the target of the link in the image-map:
<html>
<head>
<script type="text/javascript">
function changeTarget()
{
document.getElementById('venus').target="_blank"
}
</script>
</head>
<body>
<img src =/w3c/jsref/"planets.gif"__width="145" height="126"__alt="Planets"__usemap ="" id="venus" />
</map>
<br />
<input type="button" onclick="changeTarget()"
value="Change target" />
</body>
</html>