Quote:
> I have a window which contains 3 frames. From the web page in the contant
> frame I open a another window with window.open command. I would like the
> close this new window when webpage in the content frame unloads.
> Can anybody please give me any suggestions.
> Thanks
> hadi
Hadi,
When you open the window, keep a reference to the new window object and use
it to close the window when the unload event is triggered:
<script>
var childWin;
var winOpen=false;
function openWindow(winURL, winName, winAttribs) {
if (winOpen) {
if(!childWin.closed) {
childWin.close();
}
}
childWin=window.open(winURL, winName, winAttribs);
winOpen=true;
Quote:
}
function closeWindow() {
if (winOpen) {
if(!childWin.closed) {
childWin.close();
}
}
Quote:
}
</script>
Just attach the closeWindow() function to whatever unload event is
appropriate and hopefully that'll do the trick.
Hope this works for you,
Tony.