• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Blood_Zero
从新开始!从心开始!
   首页    新随笔       管理     

JavaScript验证注册信息

<script language="javascript">
function check_login(form){
    if(form.username.value==""){
        alert("用户名不能为空");
        return(flase);
    }
    if(form.password.value==""){
        alert("密码不能为空");
        return(flase);
    }
    if(form.repwd.value==""){
        alert("确认密码不能为空");
        return(flase);
    }
    if(form.password.value!=form.repwd.value){
        alert("两次密码不一致");
        return(flase);
    }
    if(form.qq.value==""){
        alert("QQ号码不能为空");
        return(flase);
    }
    if(isNaN(form.qq.value)){
        alert("QQ格式不对");
    }
}
</script>
<form name="form" action="" method="post" onSubmit="return check_login(this)">
用户名<input type="text" name="username"><br>
密码:<input type="text" name="password"><br>
确认:<input type="text" name="repwd"><br>
qq:<input type="text" name="qq"><br>
<input type="submit" value="提交">
</form>

 

posted @ 2015-04-08 12:46  BloodZero  阅读(417)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3