对window.open禁用父窗口,并重新启用弹出窗口关闭 [英] disable Parent window on window.open and re enable on close of popup window
问题描述
我在那里我打开一个弹出窗口上点击按钮父窗口:
功能测试()
{
$(机构)追加('< DIV ID =modalPopUp级=modalOverlay>');
变种popupWindow = window.open(Test.aspx文件,'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no,状态=无'); }
现在我能够打开弹出窗口并关闭父窗口,但现在我要赶关闭按钮,点击+点击弹出窗口弹出事件的外面,所以我可以从我身上卸下ModalPopUp这样我就可以重新eanble父DIV。我如何做到这一点?
-
您可以使用window.opener对象访问父窗口的弹出窗口,或者:
-
您可以从父与popupWindow对象访问子窗口。例如,如果弹出关闭您可以在这样的父窗口unload事件进行注册:
popupWindow.onunload =函数(){警报('弹出被关闭或重定向')}
I have a parent window where i open up a Popup window on click of a button:
function Test()
{
$("body").append('<div id="modalPopUp" class="modalOverlay">');
var popupWindow = window.open("test.aspx", 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');
}
Right now i am able to open up popup and disable parent window, but now i want to catch close button click + click outside of popup events on Popup window, so i can remove ModalPopUp from my body so i can re eanble parent div. How do i achieve that?
You can access the parent window in your popup Window using the window.opener object, or:
You can access the child window from the parent with the popupWindow object. e.g if the popup closes you can register the unload event in your parent window as such:
popupWindow.onunload = function() { alert('popup was closed or redirected') }
这篇关于对window.open禁用父窗口,并重新启用弹出窗口关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!