[Javascript] Closing a pop-up containing a frameset when focus is lost

Rodney Myers rodney at aflyingstart.net
Mon Sep 3 14:05:50 CDT 2001


Popup has two frames.
One is navigational. The larger one contains various forms.

The forms take data from, and pass data to, arrays and objects in the
main window.

While focus remains on the child window the pages and related objects in
the main window (also a frameset) do not change. But once focus passes
to the main window (or away from the child window) the presumption must
be that a mismatch could arise between current states of the child/popup
window data and the parent/main window.

Therefore it seems to me prudent to close the child window if focus is
lost. And there seems to be two ways of going about that:

1) If focus is on parent window and child window exists, close child
window.
Reliable code for testing child window existence cross-browser?


2) if focus is lost from child window close child window.
What event of what object can I use? If I put onblur into the frameset
the window closes as soon as it has opened.



I want this to work in MSIE 4+ and NN4+

TIA

Rodney





More information about the Javascript mailing list