问题
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:
<a href="#" onClick="window.open('http://www.yahoo.com', '_blank')">test</a>
Easy as that.
Or without JS
<a href="http://yahoo.com" target="_blank">test</a>
来源:https://stackoverflow.com/questions/13335954/how-can-i-make-a-html-a-href-hyperlink-open-a-new-window-using-window-location