tryit_view.asp@filename=try_dom_anchor_href
来自「W3Schools tutorial..web designing」· ASP@FILENAME=TRY_DOM_ANCHOR_HREF 代码 · 共 22 行
ASP@FILENAME=TRY_DOM_ANCHOR_HREF
22 行
<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('myAnchor').innerHTML="Visit W3Schools";
document.getElementById('myAnchor').href="../default.htm";
document.getElementById('myAnchor').target="_blank";
}
</script>
</head>
<body>
<a id="myAnchor" href="../../www.microsoft.com/default.htm">Visit Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
<p>In this example we change the text and the URL of a hyperlink. We also change the target attribute.
The target attribute is by default set to "_self", which means that the link will open in the same window.
By setting the target attribute to "_blank", the link will open in a new window.</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?