I need to close the child window that has been loaded from a native window. If you do not postback to the parent window server then this code is OK. When a postback occurred in the original window, the value of the variable (childwin) disappeared and I can not close the hair window with this code. Your array will clear the child every time the page is loaded. So back in the array there will be nothing. This is the reason why hair windows are not being closed. A work has been mentioned around Try to do something like [Nothing was tested, and it will not be ensured that it will work, just give a try )] Original window (all pages) hair window Your child window open function Your close button event Potential improvements for the query> But, after a child's postback, an error occurs in parent_close (), the value of childStatus [key] is not an object, and it can not be done to the childSatatus [ Key]. Close ()) Change
Hair window to window.open () method.
I need to close this hair window by clicking a logout button or close button that is in the original window.
My code:
var childWin = []; // hair window open event function child_open (url) {childWin [childWin.length] = window.open (url); } // a logout button or close button event function parent_close () {for (i = 0; i & lt; childWin.length; i ++) {if (childWin [i] == faucet) returned incorrect; ChildWin [i] .close (); } Window.close (); }
The problem is - Parents want to stop postbacked children too. Is there a solution for this?
Thanks for all your interests and answers.
var childStatus = {};
var timerHandler, windowName = window.name, popupHandle = ""; Funciton ChildCallBack () {try (if popupHandle == "popupHandle == null) {popupHandle = window.opener.childStatus [windowName]; // ChildCallBack (); // There is no need for silkback, because we already have a timer {else} window.opener.childStatus [windowName] = popupHandle; }} Hold (e) {}} timer handler = window.setInterval (ChildCallBack, 500); Function window_onclose () {try {window.clearInterval (timerHandler); Window.opener.childStatus [windowName] = Faucet; } Hold (e) {}} window.onclose = window_onclose;
// child window open event function child_open (url) {var winHandle = window open (URL, "Give some unique names for every window here"); WinHandle.popupHandle = winHandle;
// a logout button or close button event function parent_close () {for ( Key position in the key key () (childStatus [key]! = Null] {childStatus [key] .close ();}} Window.close ();}
timer handler = window.setInterval (ChildCallBack, 100);
if (popupHandle == "" || popupHandle == null ) {// Get PopupHolders from Point Window PopupHandle = window.opener .childStatus [windowName]; TimerHandler = Window.SetInternval (ChildClackback, 100);}
Comments
Post a Comment