[thelist] Closing a window with JavaScript

Craig cd-ml at aardvark.net.au
Wed Aug 21 12:27:00 CDT 2002


I know that works but i'm trying to open a pop-up, change to a new page (or
URL), then on the new page, close the pop-up. I'm using the correct references
but it just ain't working :)

----- Original Message -----
From: "Tom Dell'Aringa" <pixelmech at yahoo.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, August 22, 2002 2:48 AM
Subject: Re: [thelist] Closing a window with JavaScript


> Craig,
>
> Here is the code you need below. The key is referring to the window
> you opened - everything in JS is correct references. Test it out, the
> window will open a Google window, do a bogus search (the page
> changes). Then click the close button on the opener page. VIola!
>
> Tom
> ------------------
> <html>
> <head>
> <script>
> function launch(newURL, newName, newFeatures, orgName) {
>   var remote = open(newURL, newName, newFeatures);
>   if (remote.opener == null)
>     remote.opener = window;
>   remote.opener.name = orgName;
>   return remote;
> }
>
> function launchRemote() {
>   myRemote = launch("http://www.google.com/", "myRemote",
> "height=400,width=400", "myWindow");
> }
>
> function closeIt()
> {
> //myRemote.location.href = "http://www.yahoo.com/";
> if (window.myRemote) myRemote.close();
> }
> </script>
> </head>
>
> <body>
> <input type="button" onclick="launchRemote();" value="launch"><br />
> <input type="button" onclick="closeIt()" value="close">
> </body>
> </html>
>
> =====
> var me = tom.pixelmech.webDeveloper();
>
> http://www.pixelmech.com/
> http://www.maccaws.com/
> [Making A Commercial Case for Adopting Web Standards]





More information about the thelist mailing list