在我单击父页面上显示的警报之前,弹出窗口不会关闭
因此,在单击警报按钮之前,子弹出窗口不会关闭,但是,当我对子窗口使用调整大小方法时,它会在显示警报之前调整大小。
这是父页面上的代码:
function ClosePopup(objWindow, strMessage) {
objWindow.close();
//objWindow.resizeTo(30, 30);
if (strMessage != '') { alert(strMessage); }
document.Block.submit();
}
这是弹出页面上的代码:
$strShowMessage = "window.opener.ClosePopup(self, '$strReclassifiedLots');";
该代码被放在提交事件后面。
So the child popup window won't close until I click the alert button, however, when I use the resize method for the child, it resizes before it shows the alert.
Here is the code on the parent page:
function ClosePopup(objWindow, strMessage) {
objWindow.close();
//objWindow.resizeTo(30, 30);
if (strMessage != '') { alert(strMessage); }
document.Block.submit();
}
And here is the code on the popup page:
$strShowMessage = "window.opener.ClosePopup(self, '$strReclassifiedLots');";
And that code gets put behind the submit event.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
回答
尝试给浏览器一点时间来完成工作(我对调整大小的显示感到有点惊讶):
请注意,在
finish
之前不会提交Block
表单被调用,所以如果您的逻辑假设这是同步的,那么这可能是一个问题。演示
父页面:
弹出页面:
我没有包含表单提交到的
showparams.jsp
页面,但它所做的只是转储出提交的字段。上面的代码在 Chrome 和 IE7 中运行得很好,没有在其他版本中进行测试,但我预计不会有问题。Answer
Try giving the browser a moment to do the work (I'm a bit surprised the resize shows up):
Note that the
Block
form won't be submitted untilfinish
gets called, so if your logic is assuming that's synchronous, it may be an issue.Demo
The parent page:
The popup page:
I haven't included the
showparams.jsp
page that the form is submitted to, but all it does is dump out the fields that were submitted. The above works just fine in Chrome and IE7, didn't test it in others but I wouldn't expect a problem.