popup not closing
I am returning an array to the parent from my popup. It all works fine but the popup doesn't close. I even tried window.close
function btnClick()
{
var myVal = $("input#hdnName").val();
var myVal1 = $("input#hid").val();
var myarray = new Array(myVal, myVal1);
win开发者_如何学JAVAdow.parent.closeDialog(myarray);
window.close();
}
By security reasons, browsers only accepts window.close()
if that window was opened by a window.open()
on the same context.
In your case, I think the problem is that the window.close()
is called by the iframe
but it isn't in the same context that opened the popup.
You can try:
- A popup without the
iframe
inside. - Or better, don't use popups. Use a div floating over your main page, displaying the
iframe
inside. In fact, there are many jQuery plugins that can do it.
精彩评论