I have a site with 3 frame sets, top, left and right. I hate frames, you hate frames, we all hate frames but they are unfortunatly I'm stuck with them, and no I can't change them, it's not my site.
I would like to set and onbeforeunload event in the left frame that will close the window if it has been opened. The point is, if the main window is refreshed, the opened window is closed (if it has been opened).
Just adding an event calling cp.close() is getting an undefined error which is understandable as it's a different frame. How would I pass the reference of the new window to the left frame if the right frame opened it?
I should ad this is not a regular website but an administration utility with very limited and controlled access, so we only have to support the latest version of FF and IE.
Anti Linux rants are usually the result of a lack of Linux experience, while anti Windows rants are usually a result of a lot of Windows experience.
<html><head></head><body>
frame b
<p onclick="top.frames['frame_c'].cp.close();">close</p></body></html>
frame c
HTML Code:
<html><head><title> new document </title><script type="text/javascript"><!--
var cp;
function openwindow(){
cp=window.open('http://google.com','cp','width=980,height=735,toolbar=yes,status=yes,location=no,resizable=yes,scrollbars=yes',true);
cp.focus();
}
//--></script></head><body>
frame c
<p onclick="openwindow()">open window</p><p onclick="cp.close()">close</p></body></html>
This opens the window from the onclick in frame c but the close onclick in frame b throws the error
Code:
top.frames.frame_c.cp is null or not an object
Anti Linux rants are usually the result of a lack of Linux experience, while anti Windows rants are usually a result of a lot of Windows experience.
Bookmarks