js 打开标签

JS打开新标签的2种方式

1.超链接<a href="http://www.jb51.net" title="脚本之家">Welcome</a>

等效于js代码

window.location.href="http://www.jb51.net";     //在同当前标签中打开标签

 

2.超链接<a href="http://www.jb51.net" title="脚本之家" target="_blank">Welcome</a>

等效于js代码

window.open("http://www.jb51.net");  //在另外新建标签中打开标签

Window open() 方法

文章来源: http://m.jb51.net/article/35691.htm

原文地址:https://www.cnblogs.com/ooo0/p/8361457.html