js 中怎样在一个新页面打开

不要window。open

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"); //在另外新建窗口中打开窗口
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-01
<a href=""www.baidu.com/" target="_blank">百度</a>
第2个回答  2013-08-01
location.replace("http://www.baidu.com/");

第3个回答  推荐于2016-09-06
document.location.href="";
或者
window.location.href="";
均是不以新窗口打开,直接替换原来的窗口本回答被提问者采纳
相似回答