JavaScript 打开新链接的两种方式

1.超链接

<a href="http://www.xuheyao.win" title="Emily's Blog">Welcome</a>

等效于js代码

window.location.href="http://www.xuheyao.win";     //在当前窗口中打开窗口

2.超链接

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

等效于js代码

window.open("http://www.xuheyao.win");              //在另外新建窗口中打开窗口

猜你喜欢

转载自blog.csdn.net/baidu_27280587/article/details/54376524