jerryxh
07-18-2002, 05:58 AM
Hello-
I am having trouble with the following piece of JavaScript code, which is supposed to open a new window when the submit button is clicked and then close the window after the cgi script has completed processing:
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var win;
function OpenWindow() {
win = window.open("http://www.asite.com","upload","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,width=290,height=170,left=665,top=440")
document.forms[0].submit();
return false;
}
function KillWindow() {
win.close();
}
//-->
</SCRIPT>
</HEAD>
<BODY ONUNLOAD="KillWindow()">
<FORM ACTION="http://www.asite.com/cgi-local/script.cgi" METHOD="post">
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1">
<TR><TD>Filename</TD></TR>
<TR><TD><INPUT TYPE="file" SIZE="22" NAME="filename"></TD></TR>
<TR><TD ALIGN="center"><INPUT TYPE="button" VALUE="Submit" ONCLICK="return OpenWindow()"></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTML>
When I run this code in IE, I get the following script error:
Line: 14
Char: 3
Error: 'win' is null or not an object
Code: 0
I would appreciate very much any help I can get with this problem.
Jerry
I am having trouble with the following piece of JavaScript code, which is supposed to open a new window when the submit button is clicked and then close the window after the cgi script has completed processing:
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var win;
function OpenWindow() {
win = window.open("http://www.asite.com","upload","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,width=290,height=170,left=665,top=440")
document.forms[0].submit();
return false;
}
function KillWindow() {
win.close();
}
//-->
</SCRIPT>
</HEAD>
<BODY ONUNLOAD="KillWindow()">
<FORM ACTION="http://www.asite.com/cgi-local/script.cgi" METHOD="post">
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1">
<TR><TD>Filename</TD></TR>
<TR><TD><INPUT TYPE="file" SIZE="22" NAME="filename"></TD></TR>
<TR><TD ALIGN="center"><INPUT TYPE="button" VALUE="Submit" ONCLICK="return OpenWindow()"></TD></TR>
</TABLE>
</FORM>
</BODY>
</HTML>
When I run this code in IE, I get the following script error:
Line: 14
Char: 3
Error: 'win' is null or not an object
Code: 0
I would appreciate very much any help I can get with this problem.
Jerry