HTML DOM target 屬性
定義和用法
target 屬性可設(shè)置或返回在何處打開區(qū)域中的 link-URL。
語法
areaObject.target=_blank|_parent|_self|_top
四個保留的目標(biāo)名稱:
- _blank - 在一個新的未命名的窗口載入文檔
- _self - 在相同的框架或窗口中載入目標(biāo)文檔
- _parent - 把文檔載入父窗口或包含了超鏈接引用的框架的框架集
- _top - 把文檔載入包含該超鏈接的窗口,取代任何當(dāng)前正在窗口中顯示的框架
實例
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 ="planets.gif"
width="145" height="126"
alt="Planets"
usemap ="#planetmap" />
<map name ="planetmap">
<area shape ="circle" coords ="124,58,8"
href ="venus.htm" id="venus" />
</map>
<br />
<input type="button" onclick="changeTarget()"
value="Change target" />
</body>
</html>