This is my code:
这是我的代码:
<a href="http://www.google.com" onClick="window.location.href='http://www.yahoo.com';return false;" target="_blank">test</a>
When you click it, it takes you to Yahoo but it does not open a new window?
当你点击它时,它会带你去雅虎但它不会打开一个新窗口?
1 个解决方案
#1
91
<a href="#" onClick="window.open('http://www.yahoo.com', '_blank')">test</a>
Easy as that.
很容易。
Or without JS
或没有JS
<a href="http://yahoo.com" target="_blank">test</a>
#1
91
<a href="#" onClick="window.open('http://www.yahoo.com', '_blank')">test</a>
Easy as that.
很容易。
Or without JS
或没有JS
<a href="http://yahoo.com" target="_blank">test</a>