zoukankan      html  css  js  c++  java
  • 表单效验

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" src="js/jquery-1.8.3.js" ></script>
    <script type="text/javascript" src="js/jquery.validate.min.js" ></script>
    <script type="text/javascript" src="js/messages_zh.js" ></script>
    <style>
    label.error{
    color: red;
    }
    </style>
    <script>
    $(function(){
    $("#checkform").validate({
    rules:{
    user:{
    required:true,
    minlength:6
    },
    password:{
    required:true,
    digits:true,
    minlength:6
    },
    repassword:{
    required:true,
    digits:true,
    minlength:6
    },
    email:{
    required:true,
    email:true
    },
    sex:{
    required:true
    }
    },
    messages:{
    user:{
    required:"用户名不能为空",
    minlength:"用户名不能少于6位"
    },
    password:{
    required:"密码不能为空",
    digits:"密码必须为数字",
    minlength:"密码不能低于6位"
    },
    repassword:{
    required:"密码不能为空",
    digits:"密码必须为数字",
    minlength:"密码不能低于6位"
    },
    email:{
    required:"邮箱必填",
    email:"邮箱格式不正确"
    },
    sex:{
    required:"性别必填"
    }
    },
    });
    });
    </script>
    </head>
    <body>
    <form action="#" id="checkform" method="post" name="regform" onsubmit="return checkform()">
    用户名: <input type="text" name="user"value="" /><br />
    密码: <input type="password" name="password" id="password" value="" /><br />
    重复密码: <input type="repassword" name="repassword" id="repassword" value="" /><br />
    邮箱: <input type="email" name="email" id="email" value="" /><br />
    性别: <input type="radio" name="sex" value="" />男
    <input type="radio" name="sex" value="" />女<br />
    <input type="submit" value="注册" />
    </form>
    </body>
    </html>

  • 相关阅读:
    Web大文件上传断点续传解决方案
    STL 源代码剖析 算法 stl_algo.h -- rotate
    BZOJ 1260 CQOI2007 涂色paint 动态规划
    Shiro学习(总结)
    数组与指针
    Doing Homework again(杭电1789)
    leetCode 75.Sort Colors (颜色排序) 解题思路和方法
    hdu 4786 Fibonacci Tree(最小生成树)
    Havel--Hakimi定理推断可图化 python
    最近小感——一个残疾人写的操作系统
  • 原文地址:https://www.cnblogs.com/xuaima/p/10479481.html
Copyright © 2011-2022 走看看