[thelist] Closing a window with JavaScript
Craig
cd-ml at aardvark.net.au
Thu Aug 22 04:19:01 CDT 2002
With help from HWG-Techniques list it is now working with the code below
(watch word-wrap).
Filename for code is 'test.asp'
<!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(showpage) {
UploadStatus =
window.open(showpage,'UploadWindow','scrollbars=no,status=no');
if (showpage=='') UploadStatus.close();
}
//-->
</script>
<%=request.form("open")%>
<form action="test.asp" method="post">
<input type="submit" value="open" name="open"
onclick="UploadStatus('page1.htm');">
<input type="button" value="close" onclick="UploadStatus('');">
</form>
</body>
</html>
Craig.
----- Original Message -----
From: "Craig" <cd-ml at aardvark.net.au>
To: <thelist at lists.evolt.org>
Sent: Thursday, August 22, 2002 1:09 AM
Subject: [thelist] 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.
>
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
More information about the thelist
mailing list