求助:用isdate函数验证日期出错
做了一个注册页面,可是检查日期的老是提示说不是日期格式,即使输入的是日期也一样,为什么???代码如下:这个是注册页面:zhuce.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #99CCFF;
}
.STYLE1 {
color: #0000FF
}
.STYLE2 {color: #FF0000}
-->
</style></head>
<body>
<div align="center">
<div style="width:840px; height:610px; background-color:#ffffff">
<h1 class="STYLE1">用户注册</h1>
<form action="savezhuce.asp" method="post" name="form" target="_self" class="STYLE1" id="form">
<table width="278" height="353" border="0">
<caption align="bottom">
</caption>
<tr>
<td width="77"><div align="justify"><span class="STYLE2">用户名</span></div></td>
<td width="191" >
<input type="text" name="username" id="username" /> </td>
</tr>
<tr>
<td><div align="justify"><span class="STYLE2">密码</span></div></td>
<td><input type="password" name="password" id="password" /></td>
</tr>
<tr>
<td><div align="justify"><span class="STYLE2">重复密码</span></div></td>
<td><input type="password" name="password2" id="password2" /></td>
</tr>
<tr>
<td><div align="justify"><span class="STYLE2">Email</span></div></td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td><div align="justify"><span class="STYLE2">性别</span></div></td>
<td><p>
<label>
<input type="radio" name="RadioGroup1" value="男" id="RadioGroup1_0" />
男
</label><label><input type="radio" name="RadioGroup1" value="女" id="RadioGroup1_1" />
女</label>
<br />
</p>
<label></label></td>
</tr>
<tr>
<td><div align="justify"><span class="STYLE2">生日</span></div></td>
<td><input type="text" name="bdate" id="bdate" /></td>
</tr> <tr>
<td colspan="2">
<div align="center">
<input type="submit" name="button" id="button" value="完成注册" />
</div></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
这个是检查的:savezhuce.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #99CCFF;
}
-->
</style></head>
<body>
<div align="center">
<div style="width:840px; height:610px; background-color:#99FFFF">
<%
'定义变量并获取信息
dim username,password,password2,bdate,email,sex
username=request.Form("username")
password=request.Form("password")
password2=request.Form("password2")
bdate=request.Form("bdate")
email=request.Form("email")
sex=request.Form("RadioGroup1")
'response.Write(bdate&sex)
'response.End()
'验证输入的信息是否合法
if username="" then
' response.Write("用户名不能为空")
%>
<script language="vbscript">
msgbox("用户名不能为空,请重新输入")
</script>
<meta http-equiv=refresh content=0;URL=zhuce.html>
<%
response.End()
end if
if password<>password2 then
' response.Write("密码输入不一致")
%>
<script language="vbscript">
msgbox("密码输入不一致,请重新输入")
</script>
<meta http-equiv=refresh content=0;URL=zhuce.html>
<%
response.End()
end if
if not isdate(bdate) then
'response.Write("生日必须为日期格式")
%>
<script language="vbscript">
msgbox("生日必须为日期格式,请重新输入")
</script>
<meta http-equiv=refresh content=0;URL=zhuce.html>
<%
response.End()
end if
'插入数据库
Dim conn,rs
'实例化
set conn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
'打开数据库连接
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("data/system.mdb")
'打开数据表
rs.open "select * from [users] where username='"&username&"'",conn,1,3
if not rs.eof then
' response.Write("用户名已存在,请重新设定")
%>
<script language="vbscript">
msgbox("用户名已存在,请重新设定")
</script>
<meta http-equiv=refresh content=0;URL=zhuce.html>
<% response.End()
else
rs.addnew
rs("username")=username
rs("password")=password
rs("bdate")=bdate
rs("email")=email
rs("sex")=sex
rs.update
response.Write("用户注册成功")
end if
'关闭数据表
rs.close
'关闭数据库
conn.close
'清除实例化
set rs=nothing
set conn=nothing
%>
<h1>恭喜,注册成功!</h1>
<p class="STYLE1">请记住您的用户资料</p>
<table width="294" height="273" border="0">
<tr>
<th width="64" scope="col">用户名</th>
<th width="214" scope="col"><%=username%></th>
</tr>
<tr>
<td>email</td>
<td><%=email%></td>
</tr>
<tr>
<td>性别</td>
<td><%=sex%></td>
</tr>
<tr>
<td>生日</td>
<td><%=bdate%></td>
</tr>
<tr>
<td colspan="2"><div align="center">修改资料</div></td>
</tr>
</table>
<p> </p>
<p> </p>
</div>
</div>
</body>
</html>