<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>文件上传</title>
<style type="text/css">
<!--
form {
font-size: 9pt;
}
body {
font-size: 9pt;
}
table {
font-size: 9pt;
}-->
</style></head>
<body bgcolor="#718BD6" leftmargin="0" topmargin="0">
<%
String method=request.getMethod();
if(method.equals("POST"))
{
String deptNo=null;
String yearNo=null;
String docNo=null;
deptNo = request.getParameter("deptno");
yearNo = request.getParameter("yearno");
docNo = request.getParameter("docno");
%>
<script language="JavaScript">
var result=new Array();
result[0]="<%=deptNo%>";
result[1]="<%=yearNo%>";
result[2]="<%=docNo%>";
parent.closeUpload(result);
</script>
<%
}
%>
<script language="JavaScript">
function fileCheck()
{
var deptno = document.forms[0].deptno.value;
var yearno = document.forms[0].yearno.value;
var docno = document.forms[0].docno.value;
if(deptno.length == 0) {
alert("发文部门不能为空");
return false;
}
else if ((yearno.match(/\d\d\d\d/)) == null || yearno.length!=4 || yearno.length!=(yearno.match(/\d\d\d\d/))[0].length) {
alert("年号输入不合法,请输入4位年份!");
return false;
} else if ((docno.match(/[0-9]{1,}/))==null || docno.length!=(docno.match(/[0-9]{1,}/))[0].length){
alert("红头文号输入不正确,请输入数字!");
return false;
}
form1.submit();//就是这句,我去掉就不报脚本错误,不去掉就报错说对象不支持此属性或方法
}
</script>
<form action="" method="POST" name="form1" id="form1">
<table>
<tr>
<td>发布部门</td>
<td><input name="deptno" id="deptno" type="text" size="25"></td>
</tr>
<tr>
<td>年号</td>
<td><input name="yearno" id="yearno" type="text" size="25">只能输入年份</td>
</tr>
<tr>
<td>红头文号</td>
<td><input name="docno" id="docno" type="text" size="25">只能输入数字</td>
</tr>
<tr>
<td><input type="button" name="submit" value="确定" onclick="fileCheck()"/></td>
<td><input type="reset" name="reset" value="重置"/></td>
</tr>
</table>
</form>
</body>
</html>-----------------------------------------浏览器提示我下面这句有错
form1.submit();
就是这句,我去掉就不报脚本错误,不去掉就报错说对象不支持此属性或方法求高手解答,如果不这样写我要如何写来提交表单啊?谢谢!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>文件上传</title>
<style type="text/css">
<!--
form {
font-size: 9pt;
}
body {
font-size: 9pt;
}
table {
font-size: 9pt;
}-->
</style></head>
<body bgcolor="#718BD6" leftmargin="0" topmargin="0">
<%
String method=request.getMethod();
if(method.equals("POST"))
{
String deptNo=null;
String yearNo=null;
String docNo=null;
deptNo = request.getParameter("deptno");
yearNo = request.getParameter("yearno");
docNo = request.getParameter("docno");
%>
<script language="JavaScript">
var result=new Array();
result[0]="<%=deptNo%>";
result[1]="<%=yearNo%>";
result[2]="<%=docNo%>";
parent.closeUpload(result);
</script>
<%
}
%>
<script language="JavaScript">
function fileCheck()
{
var deptno = document.forms[0].deptno.value;
var yearno = document.forms[0].yearno.value;
var docno = document.forms[0].docno.value;
if(deptno.length == 0) {
alert("发文部门不能为空");
return false;
}
else if ((yearno.match(/\d\d\d\d/)) == null || yearno.length!=4 || yearno.length!=(yearno.match(/\d\d\d\d/))[0].length) {
alert("年号输入不合法,请输入4位年份!");
return false;
} else if ((docno.match(/[0-9]{1,}/))==null || docno.length!=(docno.match(/[0-9]{1,}/))[0].length){
alert("红头文号输入不正确,请输入数字!");
return false;
}
form1.submit();//就是这句,我去掉就不报脚本错误,不去掉就报错说对象不支持此属性或方法
}
</script>
<form action="" method="POST" name="form1" id="form1">
<table>
<tr>
<td>发布部门</td>
<td><input name="deptno" id="deptno" type="text" size="25"></td>
</tr>
<tr>
<td>年号</td>
<td><input name="yearno" id="yearno" type="text" size="25">只能输入年份</td>
</tr>
<tr>
<td>红头文号</td>
<td><input name="docno" id="docno" type="text" size="25">只能输入数字</td>
</tr>
<tr>
<td><input type="button" name="submit" value="确定" onclick="fileCheck()"/></td>
<td><input type="reset" name="reset" value="重置"/></td>
</tr>
</table>
</form>
</body>
</html>-----------------------------------------浏览器提示我下面这句有错
form1.submit();
就是这句,我去掉就不报脚本错误,不去掉就报错说对象不支持此属性或方法求高手解答,如果不这样写我要如何写来提交表单啊?谢谢!
把你这个按钮的名字改一下就OK,不要叫submit