Re: ASP page, closing a window with JavaScript

by "Craig" <cd-ml(at)aardvark.net.au>

 Date:  Thu, 22 Aug 2002 17:17:36 +0930
 To:  "Brett Errington" <brett(at)opensearch.com>,
<hwg-techniques(at)hwg.org>
 References:  brett
  todo: View Thread, Original
Thanks Brett!  I sort of had an idea that it was 'losing the object' when I
changed pages, but didn't know the solution.
If anyone wants the ASP page with JS, let me know and I'll post it.

Craig.

----- Original Message -----
From: "Brett Errington" <brett(at)opensearch.com>
To: <hwg-techniques(at)hwg.org>
Sent: Thursday, August 22, 2002 11:02 AM
Subject: RE: ASP page, closing a window with JavaScript


> Hi
>
> Yes you can however it can be a problem from memory because you have
> lost the object with which to refer to the popup window when you change
> pages. The way to get it back again is to run the same UploadStatus()
> function with a blank URL. This should create a new object for the popup
> window but not actually launch a new popup. If you have troubles let me
> know because I'm not 100% sure if I have remembered the exact procedure
> but it should work.
>
> Later,
> Brett
>
> "Oooooh... they have the Internet on computers now..." - Homer Simpson
>
> -----Original Message-----
> From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org]
> On Behalf Of Craig
> Sent: Thursday, 22 August 2002 12:46 AM
> To: hwg-techniques(at)hwg.org
> Subject: ASP page, closing a window with JavaScript
>
> Hi,
>
> Can you close a window with JavaScript after the page changes (for lack
> of a
> better word)?
>
> I have the ASP page below (watch the word-wrap). It simply opens a new
> window
> when the 'open' button is clicked, and tries to close it with the
> 'close'
> button. The 'open' button is a submit type which submits the form.  I've
> tried
> to simplify the page and remove anything that's not related.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> <script language="javascript">
>  <!--
>  function UploadStatus() {
>   var w = 480, h = 340;
>   //if (document.all || document.layers) {
>      w = screen.availWidth;
>      h = screen.availHeight;
>   //}
>   var popW = 150, popH = 150;
>   var leftPos = (w-popW)/2, topPos = (h-popH)/2;
>   UploadStatus =
> window.open('page.htm','UploadWindow','scrollbars=no,status=no,width=' +
> popW
> + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
>  }
>  function CloseUpload() {
>   UploadStatus.close();
>  }
>  //-->
> </script>
> <%=request.form("open")%>
> <form action="test.asp" method="post">
> <input type="submit" value="open" name="open" onclick="UploadStatus();">
> <input type="button" value="close" onclick="CloseUpload();">
> </form>
> </body>
> </html>
>
> Thanks,
> Craig.
>
>
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA