javascript中window.open()与window.location.href的区别
2016-06-30 16:18
513 查看
window.open("index.aspx",'top'); 只是表示打开这个页面,并不是打开并刷新index.aspx
window.location.href="index.aspx"; 表示重新定向到新页面,同时刷新打开的这个页面;
eg:
<tr><td style="width:96%;">进行中项目</td><td><img alt="" src="Images/2emorewe.gif" style="text-align:right;cursor:hand;"
onclick="JavaScript:window.open('ProjectList.aspx?flag=0','_top');"/></td></tr>
<tr><td style="width:96%;">进行中项目</td><td><img alt="" src="Images/2emorewe.gif" style="text-align:right;cursor:hand;" onclick="javascript:window.location.href='ProjectList.aspx?flag=0';"/></td></tr>
这两个的效果不同
window.location.href="index.aspx"; 表示重新定向到新页面,同时刷新打开的这个页面;
eg:
<tr><td style="width:96%;">进行中项目</td><td><img alt="" src="Images/2emorewe.gif" style="text-align:right;cursor:hand;"
onclick="JavaScript:window.open('ProjectList.aspx?flag=0','_top');"/></td></tr>
<tr><td style="width:96%;">进行中项目</td><td><img alt="" src="Images/2emorewe.gif" style="text-align:right;cursor:hand;" onclick="javascript:window.location.href='ProjectList.aspx?flag=0';"/></td></tr>
这两个的效果不同
相关文章推荐
- 使用JS提交表单
- js点击button按钮跳转到另一个新页面
- jsp页面报错提示编码错误信息
- js用到的一些工具方法
- Javascript DOM Event对象方法详解
- retinajs 使用方法
- js精确计算
- jsp实现局部刷新的一种方法
- 解决使用fastJson中出现$ref问题
- JavaScript高级程序设计——第3章:基本概念
- js——页面回到顶部
- 前台JS 实现截图保存功能
- fastjson解析json时报错default constructor not found. class............
- JS实现添加,替换,删除节点元素的方法
- JAVASCRIPT下window.location.href通过url传递参数
- JS设计模式
- 关于JS 事件冒泡和onclick,click,on()事件触发顺序
- 获取URL参数的几种方式
- js取得文档的高度和宽度
- JSP简易聊天室