In the popup, you can reference that function as follows:-
[<code>
//...get a pointer to the exit function we will invoke...
exitFuncName = window.opener.exitFunction;
exitFunc = window.opener.document.forms[0][exitFuncName];
</code>]
Then you can call it as part of the function that closes the popup window.
This might be when the user clicks the OK button, for example.
[<code>
function okClick() {
.......
if ( exitFuncName != '' ) {
eval('window.opener.' + exitFuncName);
}
.......
}
</code>]
Note that we check if we have a handle to a function (well, to something
anyway) before we try to run it.
This technique dates back to Netscape 3.x and IE4.x. The only problems I have
had are with a particular version of IE5.0x, which are security related.
First of all, I'm not talking about modal windows, opened with showModalDialog(), but those opened with window.open().
In the parent window, create a handle to the function you want to call on exit, e.g.
[<br clear="all" /><code> exitFunction = myExitFunction; </code>]
In the popup, you can reference that function as follows:-
[<code> //...get a pointer to the exit function we will invoke... exitFuncName = window.opener.exitFunction; exitFunc = window.opener.document.forms[0][exitFuncName]; </code>]
Then you can call it as part of the function that closes the popup window. This might be when the user clicks the OK button, for example.
[<code> function okClick() { ....... if ( exitFuncName != '' ) { eval('window.opener.' + exitFuncName); } ....... } </code>]
Note that we check if we have a handle to a function (well, to something anyway) before we try to run it.
This technique dates back to Netscape 3.x and IE4.x. The only problems I have had are with a particular version of IE5.0x, which are security related.