| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 510 人关注过本帖
标题:求助:用isdate函数验证日期出错
只看楼主 加入收藏
jade96
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-12-13
收藏
 问题点数:0 回复次数:0 
求助:用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">&nbsp;
      </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>&nbsp;</p>
    <p>&nbsp;</p>
</div>

</div>
</body>
</html>
搜索更多相关主题的帖子: asp 
2008-12-13 17:24
快速回复:求助:用isdate函数验证日期出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031748 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved