一个用户注册常用表单验证

 一个用户注册常用表单验证...
<script Language="JavaScript" Type="text/javascript">
<!--
function Validator(theForm)
{

if (theForm.Username.value == "")
{
    alert("请输入用户名!");
    theForm.Username.focus();
    return (false);
}

if (theForm.photofold.value =="")
{
    alert("请输入相册名!");
    theForm.photofold.focus();
    return (false);
}

if (theForm.pass.value == "")
{
    alert("请输入密码!");
    theForm.pass.focus();
    return (false);
}

if (theForm.pass.value.length < 6)
{
    alert("密码请至少输入 6 个字符。");
    theForm.pass.focus();
    return (false);
}

   if (theForm.pass.value !== theForm.repass.value)
{
    alert("两次输入的密码不一致!");
    theForm.pass.focus();
    return (false);
}

    if (theForm.email.value == "")
{
    alert("请输入您的邮箱地址!");
    theForm.pass.focus();
    return (false);
}
else
{
    if (theForm.email.value.charAt(0)=="." ||       
         theForm.email.value.charAt(0)=="@"||      
         theForm.email.value.indexOf('@', 0) == -1 ||
         theForm.email.value.indexOf('.', 0) == -1 ||
         theForm.email.value.lastIndexOf("@")==theForm.email.value.length-1 ||
         theForm.email.value.lastIndexOf(".")==theForm.email.value.length-1)
     {
      alert("Email地址格式不正确!");
      theForm.email.focus();
      return false;
      }
   }

return (true);
}
//--></script>


<form action="adm_login.asp" method="POST" name="FormReg" id="FormReg" οnsubmit="return Validator(this)" language="JavaScript">


提交按钮:

<input name="FormReg" type="submit" value="提 交">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值