js实现关闭子页面父页面同时刷新

admin 2015年1月26日15:16:28脚本语言评论2,545 次浏览阅读模式

做项目的时候,需要实现这样一个功能:弹出一个窗口,对该窗口进行操作,操作结束后关闭该窗口,对父窗口进行刷新操作;纠结了小一会儿呢.查了一下资料,然后自己实践一下,成功了,下面将我查到的资料分享一下吧;
 

用iframe、弹出子页面刷新父页面

iframe
   parent.location.reload();

弹出子页面
   window.opener.location.reload();--这个方法是我尝试过的,可以成功实现我想要的功能,其他的没有尝试,不能保证绝对的正确.

子窗口刷新父窗口

    self.window.opener.locaction.reload();

刷新一open()方法打开的窗口

    window.opener.location.href = window.opener.location.href

刷新以winodw.showModelDialog()方法打开的窗口

    window.parent.dialogArguments.document.execCommand('Refresh'); 

或

 

Response.Write("<script>window.location.href = window.location.href</script>");

刷新本页Response.Write("<script>window.location.href=window.location.href; </script>");

刷新父页和本页面:

Response.Write("<script>alert('提交成功!');window.location.href=window.location.href;window.opener.location=window.opener.location;</script>");

 

相关文章
weinxin
我的微信
微信扫一扫
admin
  • 本文由 发表于 2015年1月26日15:16:28
  • 转载请务必保留本文链接:https://anyun.org/a/jishuguanzhu/bianchengchalou/jiaobenyuyan/2015/0126/4455.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: