View Full Version : javascript for closing a specific window?
quant
Oct 23rd, 2001, 06:15 AM
Hi,
I'm looking for a javascript, which would close a specific pop-up window. It should work like this:
open.html
\--open--> pop-up.html <--close-\
\--open--> closing.html ----------/
Open.html opens onload the pop-up.html and the closing.html. Then the closing.html should close onload the pop-up window with pop-up.html.
Anybody knows, how to do this:)?
Tommy
Oct 23rd, 2001, 09:00 AM
Hi quant,
Try this script, it will let you open and close the windows:
<HTML>
<HEAD>
<TITLE>Window Test</TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT>
<!-- Hide script from old browsers
function openWindow() {
newWindow = window.open('', 'newWin', 'toolbar=yes,location=yes,scrollbars=yes,width=300,height=200')
}
function closeWindow() {
newWindow.close()
}
// End hiding script from old browsers -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR=WHITE>
<CENTER><H1>Open Windows, close windows</H1>
<H3><A HREF="javascript: openWindow()">Open a new window</A> <A HREF="javascript:closeWindow()">Close the window</A></H3>
</CENTER>
</BODY>
</HTML>
quant
Oct 23rd, 2001, 12:16 PM
First of all I'd like to thank you very much for your help. I really appreciate it. Unfortunatly this script won't do it, because I open the popup from the open.html file but need to close the window from the closer.html. It meens open.html opens the window and closer.html closes it. I tried this sofar:
opened the window with this script:
wi ndow.open("ddd.html","WINDOW1");
and tried to close it with this script:
WINDOW1.close()
and then with this:
wi ndow.open("closeit.html","WINDOW1");
(closeit.html contains an onload-close script)
But nothing works, it is driving me nuts, I don't know what am I doing wrong. If you have any ideas how to solve this problem, please let me know. Thanks :)
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.