The*_*Kid 52 html hyperlink window.location
这是我的代码:
<a href="http://www.google.com" onClick="window.location.href='http://www.yahoo.com';return false;" target="_blank">test</a>
Run Code Online (Sandbox Code Playgroud)
当你点击它,它会带你到雅虎,但它没有打开一个新窗口?
Joh*_*ohn 97
<a href="#" onClick="window.open('http://www.yahoo.com', '_blank')">test</a>
Run Code Online (Sandbox Code Playgroud)
很简单.
或者没有JS
<a href="http://yahoo.com" target="_blank">test</a>
Run Code Online (Sandbox Code Playgroud)
为了在新窗口中打开链接,请添加 Javascript 命令
onclick="window.open('text-link.htm', 'name','width=600,height=400')标签内<a>:
<a href="../html-link.htm" target="popup" onclick="window.open('../html-link.htm','name','width=600,height=400')">Open page in new window</a>
Run Code Online (Sandbox Code Playgroud)