| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 618 人关注过本帖
标题:为什么用户名和密码没有验证就能提交?是哪里错了?请指教!
取消只看楼主 加入收藏
suoyuan888
Rank: 2
等 级:论坛游民
帖 子:58
专家分:16
注 册:2009-8-24
结帖率:92.86%
收藏
已结贴  问题点数:20 回复次数:1 
为什么用户名和密码没有验证就能提交?是哪里错了?请指教!
请高手帮忙看看这段代码,是哪里出了问题,为什么提交时没有经过验证直接就转到add.jsp页面上去了?(add.jsp是随便写了两个字的一个普通页。)
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE2 {
    font-size: 24px;
    font-family: "新宋体";
    color: #FF0000;
}
.STYLE3 {
    color: #0033FF;
    font-size: 12px;
    font-family: "新宋体";
}
.STYLE4 {color: #FF0000}
.STYLE6 {font-size: 14px; font-family: "新宋体"; }
.STYLE8 {font-size: 14px; font-family: "新宋体"; color: #0000FF; }
.STYLE10 {font-size: 14px; font-family: "新宋体"; color: #0033FF; }
.STYLE12 {font-size: 12px; font-family: "新宋体"; }
-->
</style>
<script language="JAVASCRIPT">
    <!--
    function check_Null(){
        if (document.form1.user_id.value==""){
            alert("用户名不能为空!");
            return false;
        }
        if (document.form1.passwd.value==""){
            alert("密码不能为空!");
            return false;
        }
        }
        if (document.form1.user_name.value==""){
            alert("真实姓名不能为空!");
            return false;
        }
        if (document.form1.gs_name.value==""){
            alert("公司名称不能为空!");
            return false;
        }
        if (document.form1.gs_call.value==""){
            alert("办公电话不能为空!");
            return false;
        }   
        return true;
    }
    // -->
    </script>
</head>
<body>
<table width="800" height="409" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="3%" align="left" valign="bottom"><img src="image/login_001C.jpg" width="30" height="60" /></td>
        <td width="94%" bgcolor="#2482AA">&nbsp;</td>
        <td width="3%" align="right" valign="bottom"><img src="image/login_003C.jpg" width="30" height="60" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center" valign="top"><table width="800" height="436" border="1" cellpadding="0" cellspacing="0" bordercolor="#2482AA">
      <tr>
        <td height="434" valign="top" bgcolor="#EFEFEF">
        <form id="form1" name=form1  onsubmit="return check_Null()" method="post" action="add.asp">
          <div align="center"><span class="STYLE2"><br />
            新用户注册<br />
            <br />
          </span>          </div>
          <table width="500" height="211" border="0" align="center" cellpadding="5" cellspacing="0">
            <tr>
              <td colspan="2" align="left" valign="bottom"><span class="STYLE8">创建您的账号信息:</span><span class="STYLE12">(以下信息中,带*项为必填项)</span></td>
              </tr>
            <tr>
              <td width="103"><div align="left" class="STYLE6">用户名:</div></td>
              <td width="377"><div align="left">
                <p>
                  <input name="user_id" type="text" size=20 id="user_id" />
                  <span class="STYLE3">检测用户名是否可用</span><span class="STYLE4">*</span></p>
                </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">密码:</div></td>
              <td><div align="left">
<input name="passwd" type="password"  id="passwd" size="25" />               
<span class="STYLE4">*</span></div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">再次输入密码:</div></td>
              <td><div align="left">
                <input name="repasswd" type="password" id="repasswd" size="25" />
                <span class="STYLE4">*</span></div></td>
            </tr>
            <tr>
              <td colspan="2" align="left"><span class="STYLE10">填写您的资料:</span></td>
              </tr>
            <tr>
              <td><div align="left" class="STYLE6">真实姓名:</div></td>
              <td><div align="left">
                <input name="user_name" type="text" id="user_name" size="25" />
                <span class="STYLE4">*</span></div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">公司名称:</div></td>
              <td><div align="left">
                <input name="gs_name" type="text" id="gs_name" size="25" />
                <span class="STYLE4">*</span></div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">所在部门:</div></td>
              <td><div align="left">
                <input name="bumen" type="text" id="bumen" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">职务:</div></td>
              <td><div align="left">
                <input name="zhiwu" type="text" id="zhiwu" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">办公电话:</div></td>
              <td><div align="left">
                <input name="gs_call" type="text" id="gs_call" size="25" />
                <span class="STYLE4">*</span></div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">办公传真:</div></td>
              <td><div align="left">
                <input name="gs_fax" type="text" id="gs_fax" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">手机:</div></td>
              <td><div align="left">
                <input name="phone" type="text" id="phone" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">QQ:</div></td>
              <td><div align="left">
                <input name="QQ" type="text" id="QQ" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">msn:</div></td>
              <td><div align="left">
                <input name="msn" type="text" id="msn" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">email:</div></td>
              <td><div align="left">
                <input name="email" type="text" id="email" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">公司地址:</div></td>
              <td><div align="left">
                <input name="gs_address" type="text" id="gs_address" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left" class="STYLE6">邮编:</div></td>
              <td><div align="left">
                <input name="textfield" type="text" size="25" />
              </div></td>
            </tr>
            <tr>
              <td><div align="left"></div></td>
              <td><div align="left"></div></td>
            </tr>
            <tr>
              <td colspan="2">
                <div align="left">
                   &nbsp;
                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                   <input type="submit" name="Submit" value="提交" />
                 &nbsp; &nbsp;
                  <input type="reset" value="重置" />
                  </div></td>
              </tr>
          </table>
                </form>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
搜索更多相关主题的帖子: 密码 用户名 指教 验证 
2009-09-03 18:09
suoyuan888
Rank: 2
等 级:论坛游民
帖 子:58
专家分:16
注 册:2009-8-24
收藏
得分:0 
回复 2楼 yms123
还是无法校验,不应该说是无法校验,是根本没执行校验的语句,我就纳闷了,提交直接就通过了...是我机器问题?应该不会啊?
2009-09-11 08:50
快速回复:为什么用户名和密码没有验证就能提交?是哪里错了?请指教!
数据加载中...
 
   



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

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