当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM target 属性

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM target 属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 459 ::
收藏到网摘: n/a

定义与用法

The target property sets or returns where to open the target URL.
target 属性可用来设置或返回目标URL的打开方式

语法

anchorObject.target=target


举例

<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('myLink').innerHTML="ruanchen"
document.getElementById('myLink').href="http://www.ruanchen.com"

document.getElementById('myLink').target="_blank"
}
</script>
</head>
<body>
<a id="myLink" href="http://www.microsoft.com">Microsoft</a>

<br /><br />
<input type="button" onclick="changeLink()" value="Change link">
</body>
</html>


尝试与演示

Change text, URL, and target attribute of a link
改变连接的文字,URL以及目标属性

评论 (0) All

登陆 | 还没注册?