asp登陆检查

 <SCRIPT LANGUAGE="JavaScript">

function check()
{
   if(checkspace(document.form1.user.value)) {
 document.userinfo.username.focus();
    alert("对不起,请填写用户名!");
 return false;
  }
    if(checkspace(document.fom1.pwd.value) || document.from.pwd.value.length < 6 || document.form1.pwd.value.length >20) {
 document.form1.pwd.focus();
    alert("密码长度不能不能这空,在6位到20位之间,请重新输入!");
 return false;
  }
    if(document.form1.pwd.value != document.form1.pwd1.value) {
 document.form1.pwd.focus();
 document.form1.pwd.value = '';
 document.form1.pwd1.value = '';
    alert("两次输入的密码不同,请重新输入!");
 return false;
  }

 if(document.form1.useremail.value.length!=0)
  {
    if (document.userinfo.useremail.value.charAt(0)=="." ||       
         document.userinfo.useremail.value.charAt(0)=="@"||      
         document.userinfo.useremail.value.indexOf('@', 0) == -1 ||
         document.userinfo.useremail.value.indexOf('.', 0) == -1 ||
         document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 ||
         document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
     {
      alert("Email地址格式不正确!");
      document.userinfo.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空!");
   document.userinfo.useremail.focus();
   return false;
   }
   if(checkspace(document.userinfo.tel.value)) {
 document.userinfo.tel.focus();
    alert("对不起,请填写联系电话!");
 return false;
  }
   if(checkspace(document.userinfo.address.value)) {
 document.userinfo.address.focus();
    alert("对不起,请填写联系地址!");
 return false;
  }
   if(checkspace(document.userinfo.postcode.value)) {
 document.userinfo.postcode.focus();
    alert("对不起,请填写邮政编码!");
 return false;
  }
 
   if(checkspace(document.userinfo.yz.value)) {
 document.userinfo.yz.focus();
    alert("对不起,请填写验证码!");
 return false;
  }
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
</script> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值