Forum Moderators: open
However it wouldn't know about the other child windows, and so you would probably want to put a onunload trigger on the parent window to try and close all the child windows.
You would have to keep a reference in the parent window of any child windows opened to achieve this.
For example see
[faqts.com...]
<INPUT TYPE=button onClick="Child=window.open
('http://www.google.com','Child')" VALUE="Open">
<INPUT TYPE=button onClick="Child.close()" VALUE="Close">
Where they assign Child, a reference to the window being opened.
Now whenever you want to open a new child window make sure you use a line similar to:
children[children.length]=etc..
You can then have one function such as:
function closeAllChildren()
{
for(var n=0;n<children.length;n++)
{children[n].close();
}
//Oh, and close self!
window.close();
}
Each child document just needs a button to call this function as follows.
<input type="button" onclick="window.opener.closeAllChildren()">