您现在的位置:首页 >> JS&Jq >> 内容

Jquery 验证注册

时间:2014-4-4 12:31:13 点击:

  核心提示:Jquery 验证注册演示JavaScript Codescript type='text/javascript'$(document).ready(function() {$.validator.a...

Jquery 验证注册

Jquery 验证注册演示

JavaScript Code
  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3. $.validator.addMethod("email", function(value, element) {
  4. return this.optional(element) || /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/i.test(value);
  5. }, "Please enter a valid email address.");
  6. $.validator.addMethod("username",function(value,element){
  7. return this.optional(element) || /^[a-zA-Z0-9._-]{3,16}$/i.test(value);
  8. },"Username are 3-15 characters");
  9. $.validator.addMethod("password",function(value,element){
  10. return this.optional(element) || /^[A-Za-z0-9!@#$%^&*()_]{6,16}$/i.test(value);
  11. },"Passwords are 6-16 characters");
  12. // Validate signup form
  13. $("#signup").validate({
  14. rules: {
  15. email: "required email",
  16. username: "required username",
  17. password: "required password",
  18. },
  19. });
  20. });
  21. </script>

    XML/HTML Code
    1. html" name="signup" id="signup">
    2. Email

    3. UserName

    4. Password


作者:不详 来源:网络
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 青春网络编程技术(www.qcfupo.com) © 2020 版权所有 All Rights Reserved.
  • Powered by qcfupo! V3.0sp1
  • 百度友情链接: 百家乐[www.chinawestnews.net/aomenbaijiale/] 赌博网[www.chinawestnews.net/amdbwz/] 海立方[www.bjl.gov.cn/bjgylc/] 娱乐城[www.gtxrmzf.gov.cn/mapai/] 娱乐城[www.hfsf.gov.cn/yfgj/] 威尼斯人[www.hllinkou.gov.cn/baijile/] 澳门威尼斯[www.jjwgj.gov.cn/wnsr/] 888真人[www.lagm.gov.cn/888zhenren/] 百乐坊[www.laoling.gov.cn/blfylc/] 现金网[www.longyu.gov.cn/xjw/] 百家乐[www.chinawestnews.net/ambjl/] 新葡京娱乐场[www.sjzedu.gov.cn/jsylc/] 时时彩[www.snjw.gov.cn/ssc/] 赌博[www.chinawestnews.net/aomendubo/]