PDA

View Full Version : How To Force A Window To Close


victoria_1018
01-03-2003, 09:49 AM
Hi All,
I have created a form page.
Is there anyway to set my script so that after an user had click the submit button to submit the quotation, the browser (window) will automatically close?

And to write the script, am I to put it on the form script, which is

<form method="POST" action="result.asp">

or

on the submit script, which is
<input type="submit" value="submit" name="B1">

Thank You

Regards
Victoria

glenngv
01-03-2003, 10:15 AM
in result.asp which is your form action, generate html like this:

result.asp:

<%
'codes here
%>
<html>
<head>
<script language="javascript">
<!--
setTimeout("window.close()",2000); //2 secs delay
//-->
</script>
</head>
<body>
The quotation has been successfully submitted.
</body>
</html>

Just be aware that if the window is not a popup window (opened by another window), a prompt will be asked to the user if he wants to close the window or not.