<script language=JavaScript>
function IsDigit()
{
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkuserinfo()
{
   if(checkspace(document.userinfo.username.value)) {
document.userinfo.username.focus();
    alert("对不起,请填写用户名!");
return false;
  }
    if(checkspace(document.userinfo.password.value) || document.userinfo.password.value.length < 6 || document.userinfo.password.value.length >20) {
document.userinfo.password.focus();
    alert("密码长度不能为空,在6位到20位之间,请重新输入!");
return false;
  }
    if(document.userinfo.password.value != document.userinfo.password1.value) {
document.userinfo.password.focus();
document.userinfo.password.value = '';
document.userinfo.password1.value = '';
    alert("两次输入的密码不同,请重新输入!");
return false;
  } if(document.userinfo.email.value.length!=0)
  {
    if (document.userinfo.email.value.charAt(0)=="." ||        
         document.userinfo.email.value.charAt(0)=="@"||       
         document.userinfo.email.value.indexOf('@', 0) == -1 || 
         document.userinfo.email.value.indexOf('.', 0) == -1 || 
         document.userinfo.email.value.lastIndexOf("@")==document.userinfo.email.value.length-1 || 
         document.userinfo.email.value.lastIndexOf(".")==document.userinfo.email.value.length-1)
     {
      alert("Email地址格式不正确!");
      document.userinfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空!");
   document.userinfo.email.focus();
   return false;
   }
   if(checkspace(document.userinfo.quesion.value)) {
document.userinfo.quesion.focus();
    alert("对不起,请填写密码提问!");
return false;
  }
   if(checkspace(document.userinfo.answer.value)) {
document.userinfo.answer.focus();
    alert("对不起,请填写密码提问的答案!");
return false;
  }
 }
 function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>
<div id="box">
<div id="head"><!--#include file="zhuce_head.asp"--></div>
    <div id="main">
      <div id="title"><img src="images/zhuce1.jpg" width="750" height="40" /></div>
     
  <div id="form">
  <%select case action
case ""%>
        <form id="userinfo" name="userinfo" method="post" action="zhuce_des.asp?action=save">
          <table width="750" height="538" border="0">
            <tr>
              <td width="149" height="66">                    <span class="STYLE1">*</span> 用户名:</td>
              <td width="591"><label for="label4">
              <input name="username" type="text" id="username" maxlength="30"/>
              </label>
  可使用的字符为(A-Z a-z 0-9)长度为6-20个字符,注意不要使用空格。 </td>
            </tr>
            
            <tr>
              <td height="60">      <span class="STYLE1">*  </span>密 码:</td>
              <td height="60"><label for="label4">
              <input name="password" type="password" id="password" maxlength="30" />
              </label>
  6-20个字符,英文或数字,注意不要使用空格</td>
            </tr>
            <tr>
              <td height="63">      <span class="STYLE1">* </span>密码确认:
                <label for="label"></label></td>
              <td height="63"><label for="label">
                <input name="password1" type="password" id="label" maxlength="30" />
              </label>
                 
                请再输入一遍您上面填写的密码 </td>
            </tr>
            <tr>
              <td height="48">      <span class="STYLE1">* </span>安全问题:</td>
              <td height="48"><label for="select"></label>
                <label for="label3"></label>
                <input type="text" name="question" id="label3" />
 
   请填入提示问题,以便您取回密码!例:MY NAME </td>
            </tr>
            <tr>
              <td height="54">      <span class="STYLE1">  * </span>问题回答:
                <label for="textfield"></label></td>
              <td height="54"><input name="answer" type="text" id="answer" maxlength="60" />                 
               请填入密码提示答案!例:HQY</td>
            </tr>
            <tr>
              <td height="51">      <span class="STYLE1">*</span> 电子邮箱:
                <label for="label2"></label></td>
              <td height="51"><input type="text" name="email" id="label2" />
                 
                 请填写您最常用的邮箱</td>
            </tr>
            <tr>
              <td height="43" colspan="2" align="center"><label for="Submit">
                <input onClick="return checkuserinfo();" type="submit" name="Submit" value="申请加入" id="Submit" />
               </label>
                <input onClick="ClearReset()" type="reset" name="Submit2" value="重新填写" id="Submit2" /></td>
            </tr>
          </table>
          </form>

解决方案 »

  1.   

    单词写错了question写成quesion了
    if(checkspace(document.userinfo.question.value)) {
        document.userinfo.question.focus();
        alert("对不起,请填写密码提问!");
        return false;
      

  2.   


    <script language=JavaScript> 
    function IsDigit() 

      return ((event.keyCode >= 48) && (event.keyCode <= 57)); 

    </script> 
    <SCRIPT LANGUAGE="JavaScript"> 
    <!-- 
    function checkuserinfo() 

    if(checkspace(document.userinfo.username.value)) { 
    document.userinfo.username.focus(); 
    alert(document.userinfo.quesion.value);
    alert("对不起,请填写用户名!"); 
    return false; 
      } else if(checkspace(document.userinfo.password.value) || document.userinfo.password.value.length < 6 || document.userinfo.password.value.length >20) { 
    document.userinfo.password.focus(); 
         alert("密码长度不能为空,在6位到20位之间,请重新输入!"); 
    return false; 
      } else if(document.userinfo.password.value != document.userinfo.password1.value) { 
    document.userinfo.password.focus(); 
    document.userinfo.password.value = ''; 
    document.userinfo.password1.value = ''; 
    alert("两次输入的密码不同,请重新输入!"); 
    return false; 
      } else if(document.userinfo.email.value.length!=0) 
      { 
        if (document.userinfo.email.value.charAt(0)=="." ||        
            document.userinfo.email.value.charAt(0)=="@"||      
            document.userinfo.email.value.indexOf('@', 0) == -1 || 
            document.userinfo.email.value.indexOf('.', 0) == -1 || 
            document.userinfo.email.value.lastIndexOf("@")==document.userinfo.email.value.length-1 || 
            document.userinfo.email.value.lastIndexOf(".")==document.userinfo.email.value.length-1) 
        { 
      alert("Email地址格式不正确!"); 
      document.userinfo.email.focus(); 
      return false; 
          } 
      } else 
      { 
      alert("Email不能为空!"); 
      document.userinfo.email.focus(); 
      return false; 
      } 
      
      
      if(checkspace(document.userinfo.question.value)) { 
    document.userinfo.question.focus(); 
    alert("对不起,请填写密码提问!"); 
    return false; 
      } else if(checkspace(document.userinfo.answer.value)) { 
    document.userinfo.answer.focus(); 
    alert("对不起,请填写密码提问的答案!"); 
    return false; 
      }
     
      
      
      function checkspace(checkstr) {
      var str = ''; 
      for(i = 0; i < checkstr.length; i++) { 
        str = str + ' '; 
      } 
      return (str == checkstr); 

    }
    //--> 
    </script>
      

  3.   

    检查检查是不是又是NAME值写错了~·