首页/javascript外包/window.open()与window.location.href的区别

window.open()与window.location.href的区别

发布-xiaoming | 浏览量-

 window.open()与window.location.href的区别

window.open("index.html",'top'); 只是表示打开这个页面,并不是打开并刷新index.html
window.location.href="index.html"; 表示重新定向到新页面,同时刷新打开的这个页面;
eg:
<tr><td style="width:96%;">进行中项目</td><td><img alt="" src="Images/demo.gif" style="text-align:right;cursor:hand;" onclick="javascript:window.open('test.html?flag=0','_top');"/></td></tr>  
<tr><td style="width:96%;">进行中项目</td><td><img alt="" src="Images/demo.gif" style="text-align:right;cursor:hand;" onclick="javascript:window.location.href='test.html?flag=0';"/></td></tr>
这两个的效果不同
 

JS获取当前网址信息

Window.open()方法参数详解

原文地址:http://www.35ui.cn/post/20180406312.html

标签Windowlocation

上一条: JS获取当前页面的URL
下一条: JS中的location属性和方法总结

或许你还对下面的文章感兴趣