【求助】为什么表单提交总是不验证~~~
究竟错在那里啊。。。。先谢谢各位~~<!-- #include file="database.asp" -->
<style type="text/css">
<!--
.style1 {font-size: xx-large}
-->
</style>
<html><head><title>用户注册</title>
<script language="javascript" src="common/common.js"></script>
</head>
<body>
<form name="submit" action="login.asp?addnew=1" method="post" onSubmit="//return check();" target="_blank">
<table align="center" width="80%">
<tr>
<td width="40%"> </td>
<td width="60%"> </td>
</tr>
<tr>
<td height="23"> </td>
<td class="style1"><strong>用户注册</strong></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr><td>
<div align="right">用户名:</div></td>
<td><input name="u_user" type="text" id="u_user" value=""></td>
</tr>
<tr>
<td><div align="right">密 码:</div></td>
<td><input name="u_code" type="password" id="u_code" value=""></td>
</tr>
<tr>
<td><div align="right">确认密码:</div></td>
<td><input name="u_code2" type="password" id="u_code2" value=""></td>
</tr>
<tr>
<td><div align="right">昵称:</div></td>
<td><input name="u_nick" type="text" id="u_nick" value=""></td>
</tr>
<tr>
<td><div align="right">出生日期:</div></td>
<td><input name="year" type="text" id="year" value="" size="5">
年
<select name="month">
<%
dim month
for month=1 to 12
%>
<option value="<%=month%>"><%=month%></option>
<%
next
%>
</select>
月
<select name="day">
<%
dim day
for day=1 to 31
%>
<option value="<%=day%>"><%=day%></option>
<%
next
%>
</select>
日 </td>
</tr>
<tr>
<td><div align="right">身份证号码:</div></td>
<td><input name="u_ID" type="text" id="u_ID" value=""></td>
</tr>
<tr>
<td><div align="right">学历:</div></td>
<td><select name="degree">
<option value="-1">请选择...</option>
<%
sql="select * from degree"
set rstDegree=opentable(sql,0)
while not rstDegree.EOF
%>
<option value="<%=rstDegree("id")%>"><%=rstDegree("d_name")%></option>
<%
rstDegree.movenext
Wend
set rstDegree=nothing
closedatabase()
%>
</select></td>
</tr>
<tr>
<td><div align="right">职业:</div></td>
<td><input name="u_occputation" type="text" id="u_occputation" value=""></td>
</tr>
<tr>
<td><div align="right">Email:</div></td>
<td><input name="u_email" type="text" id="u_email" value=""></td>
</tr>
<tr>
<td><div align="right">联系电话:</div></td>
<td><input name="u_phone" type="text" id="u_phone" value=""></td>
</tr>
<tr>
<td><div align="right">手机号码:</div></td>
<td><input name="u_cellphone" type="text" id="u_cellphone" value=""></td>
</tr>
<tr>
<td><div align="right">联系地址:</div></td>
<td><input name="u_address" type="text" value=""></td>
</tr>
<tr>
<td><div align="right">个人爱好:</div></td>
<td><textarea name="u_hobby" rows="5" id="u_hobby"></textarea></td>
</tr>
<tr>
<td height="43" colspan="2"><div align="center">
<input type="submit" name="Submit" value="注册">
<input type="reset" name="Submit" value="重置">
</div></td>
</tr></table>
</form>
</body>
<script language="javascript">
function check()
{
try
{
checkID
(
document.all.u_code.value,
document.all.year.value,
document.all.month.options(document.all.sel_month.selectedIndex).value,
document.all.day.options(document.all.sel_day.selectedIndex).value,
);
}
catch(e)
{
alert(e);
return false;
}
try
{
checkdate(document.all.year.value,
document.all.month.options(document.all.sel_month.selectedIndex).value,
document.all.day.options(document.all.sel_day.selectedIndex).value)
}
catch(e)
{
alert("出生日期"+e);
return false;
}
if(document.all.u_user.value=="")
{
alert("用户名不能为空");
return false;
}
if(document.all.u_nick.value=="")
{
alert("昵称不能为空");
return false;
}
if(document.all.u_code.value!=document.all.u_code2.value )
{
alert("两次输入密码不一致");
return false;
}
if(document.all.u_code.value=="")
{
alert("密码不能为空");
return false;
}
else
{
if(document.all.u_code.value.length<6)
alert("密码不能小于6位");
return false;
}
if(document.all.degree.options(document.all.sel_u_degree.selectedIndex).value=="-1")
{
alert("请选择学历");
return false;
}
return true;
}
</script>
</html>