JS打开新窗口的2种方式
发布时间:2016-12-30 来源:查字典编辑
摘要:1.超链接Welcome等效于js代码window.location.href="http://www.jb51.net";//在同当前窗口...
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"); //在另外新建窗口中打开窗口