栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

关闭JavaScript中的弹出窗口后如何刷新父页面?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

关闭JavaScript中的弹出窗口后如何刷新父页面?

根据我对其他答案的评论,您只需要处理该

window.onunload
事件并使用该
window.opener
属性即可告诉调用页面刷新。

2.add.jsp

<html><head>    <script type="text/javascript">        //ADDED START        window.onunload = refreshParent;        function refreshParent() { window.opener.location.reload();        }        //ADDED END        $(document).ready(function(){ $("#savebtn").click(function(e) {     $.ajax({         type: "POST",         url: "RecordHandler",         data: dataString,         success: function(data){    $('body').html(data);   $('#msg').html('New Record Added Successfully.');   window.timeout(CloseMe, 1000); <-- not sure on the syntax    but have a timeout which triggers an event   to close the form once a success has been handled.   Probably should do something incase of an error.         }     });     return false; <-- this should stop the window from unloading.  });         function CloseMe()         {  window.opener.location.reload();  window.close();         }   </head>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/635891.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号