子窗口关闭,父窗口刷新
1、这样写显然是父窗口重新加载一次,所以会出现我们常见的那种'重试'选项,所以不推荐
Response.Write("<script>window.opener.location.reload();window.close();</script>"); 2.推荐第二种:
Response.Write("<script>window.opener.location.href=window.opener.location.href;alert('操作完成!');window.close();</script>"); 3、子窗口传值给父窗口,然后关闭子窗口;
获取父窗口控件的ID,然后把子窗口的得到的值传给它,随后关闭,很崇拜子窗口的献身精神啦,哈哈!Response.Write("<script language='javascript'>window.parent.opener.document.getElementById('txtBlBm').value ='" + txtYgbm + "';window.parent.opener.document.getElementById('txtBm').value ='" + valueYgbm + "';window.parent.close();</script>");
4、获取父窗口的某个控件进行刷新
1 Response.Write("<script>window.opener.document.getElementById('btnSearch').click();alert('落实意见完成!');window.close();</script>");
本文来自德仔工作室 http://www.dezai.cn/Channel/Web/ArticleShow.Aspx?AI=68259
本文介绍四种方法实现子窗口关闭同时父窗口刷新或更新指定控件的状态,包括使用JavaScript直接刷新页面、通过设置href属性刷新、向父窗口传递值及触发父窗口中特定控件的操作。
1100

被折叠的 条评论
为什么被折叠?



