任何人都可以从子 iframe 关闭由 Jquery 插件 bPopup 生成的弹出窗口吗?
好的,这个故事有点长,但希望您能耐心听我说,以便了解问题的一些背景:
我正在使用 ASP.NET 为门户开发注册部分,并使事情变得更好, 我决定使用此处中的bPopup将注册页面加载到调用页面(父页面)的iframe中。现在我需要一种在成功注册后关闭 iframe 的方法,因此从注册页面的代码隐藏(嵌套在 iframe 中)我尝试了来自父级的 Javascript 函数,该函数允许我这样做,这是关闭 iframe 的函数由插件生成:
function bPopup_close() {
$(".bClose").closePopup();
return false;
}
这是 iframe 后面的代码(该函数将在提交时调用):
ClientScript.RegisterOnSubmitStatement
(GetType(), "Javascript", "javascript: window.opener.bPopup_close();");
我无法关闭弹出窗口。有趣的是,Firebug 告诉我,在我单击提交按钮后,window.opener 为空。这是否意味着父级确实已关闭?不管怎样,弹出窗口仍然存在......
希望你们能分享一些类似的见解吗?
Okay, the story is abit long but hope you can bear with me so that there could be some background to the problem:
I'm developing the registration section for a portal using ASP.NET and to make things nice,
I decided to use bPopup from here to load the registration page into the iframe of the calling page (parent page). Now I need a way to close down the iframe after a successful registration so from the codebehind of the registration page (nested in the iframe) I tried a Javascript function from the parent that allows me to do so, here's the function to close the iframe generated by the plugin:
function bPopup_close() {
$(".bClose").closePopup();
return false;
}
and here's the code behind from the iframe (the function will be called on submit):
ClientScript.RegisterOnSubmitStatement
(GetType(), "Javascript", "javascript: window.opener.bPopup_close();");
I wasn't able to close the popup. Interestingly, Firebug showed me that after I clicked the submit button, window.opener was null. Does that mean that the parent was indeed closed? Anyway the popup was still there...
Hope you guys could share some insights on anything similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可以看到 dinbror 已经在他的页面上回答了你:)
I can see that dinbror already answered you on his page :)
折腾了半天,终于搞定了:
代码 bclose() 是:
After half a day, I finally got it working with:
and the code bclose() is: