锘??xml version="1.0" encoding="utf-8" standalone="yes"?>免费日韩av,三级在线电影,久久五月天综合http://www.aygfsteel.com/zuofei-bie/category/44470.htmljava and phpzh-cnWed, 31 Mar 2010 07:45:11 GMTWed, 31 Mar 2010 07:45:11 GMT60Jquery validate (寮曠敤)http://www.aygfsteel.com/zuofei-bie/archive/2010/03/31/317062.html鍒槰闈?/dc:creator>鍒槰闈?/author>Wed, 31 Mar 2010 07:27:00 GMThttp://www.aygfsteel.com/zuofei-bie/archive/2010/03/31/317062.htmlhttp://www.aygfsteel.com/zuofei-bie/comments/317062.htmlhttp://www.aygfsteel.com/zuofei-bie/archive/2010/03/31/317062.html#Feedback0http://www.aygfsteel.com/zuofei-bie/comments/commentRss/317062.htmlhttp://www.aygfsteel.com/zuofei-bie/services/trackbacks/317062.html
  • $(document).ready(function(){    
  •   
  • /* 璁劇疆榛樿灞炴?nbsp;*/    
  • $.validator.setDefaults({    
  •   submitHandler: function(form) { form.submit(); }    
  • });    
  • // 涓枃瀛椾袱涓瓧鑺?nbsp;   
  • jQuery.validator.addMethod("byteRangeLength", function(value, element, param) {    
  •   var length = value.length;    
  •   for(var i = 0; i < value.length; i++){    
  •    if(value.charCodeAt(i) > 127){    
  •     length++;    
  •    }    
  •   }    
  •   return this.optional(element) || ( length >= param[0] && length <= param[1] );    
  • }, "璇風(fēng)‘淇濊緭鍏ョ殑鍊煎湪3-15涓瓧鑺備箣闂?涓涓腑鏂囧瓧綆?涓瓧鑺?");    
  •   
  • /* 榪藉姞鑷畾涔夐獙璇佹柟娉?nbsp;*/    
  • // 韜喚璇佸彿鐮侀獙璇?nbsp;   
  • jQuery.validator.addMethod("isIdCardNo", function(value, element) {    
  •   return this.optional(element) || isIdCardNo(value);    
  • }, "璇鋒紜緭鍏ユ?zhèn)ㄧ殑桧n浠借瘉鍙風(fēng)爜");    
  •   
  • // 瀛楃楠岃瘉    
  • jQuery.validator.addMethod("userName", function(value, element) {    
  •   return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);    
  • }, "鐢ㄦ埛鍚嶅彧鑳藉寘鎷腑鏂囧瓧銆佽嫳鏂囧瓧姣嶃佹暟瀛楀拰涓嬪垝綰?);    
  •   
  • // 鎵嬫満鍙風(fēng)爜楠岃瘉    
  • jQuery.validator.addMethod("isMobile", function(value, element) {    
  •   var length = value.length;    
  •   return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/.test(value));    
  • }, "璇鋒紜~鍐欐?zhèn)ㄧ殑鎵嬫満鍙风?);    
  •   
  • // 鐢?shù)璇濆忥L(fēng)爜楠岃瘉    
  • jQuery.validator.addMethod("isPhone", function(value, element) {    
  •   var tel = /^(\d{3,4}-?)?\d{7,9}$/g;    
  •   return this.optional(element) || (tel.test(value));    
  • }, "璇鋒紜~鍐欐?zhèn)ㄧ殑鐢?shù)璇濆彿鐮?);    
  •   
  • // 閭斂緙栫爜楠岃瘉    
  • jQuery.validator.addMethod("isZipCode", function(value, element) {    
  •   var tel = /^[0-9]{6}$/;    
  •   return this.optional(element) || (tel.test(value));    
  • }, "璇鋒紜~鍐欐?zhèn)ㄧ殑閭斂缂栫?);    
  • $(regFrom).validate({    
  • /* 璁劇疆楠岃瘉瑙勫垯 */    
  •   rules: {    
  •    userName: {    
  •     required: true,    
  •     userName: true,    
  •     byteRangeLength: [3,15]    
  •    },    
  •    password: {    
  •     required: true,    
  •     minLength: 5    
  •    },    
  •    repassword: {    
  •     required: true,    
  •     minLength: 5,    
  •     equalTo: "#password"    
  •    },    
  •    question: {    
  •     required: true    
  •    },    
  •    answer: {    
  •     required: true    
  •    },    
  •    realName: {    
  •     required: true    
  •    },    
  •    cardNumber: {    
  •     isIdCardNo: true    
  •    },    
  •    mobilePhone: {    
  •     isMobile: true    
  •    },    
  •    phone: {    
  •     isPhone: true    
  •    },    
  •    email: {    
  •     required: true,    
  •     email: true    
  •    },    
  •    zipCode: {    
  •     isZipCode:true    
  •    }    
  •   },    
  • /* 璁劇疆閿欒淇℃伅 */    
  •   messages: {    
  •    userName: {    
  •     required: "璇峰~鍐欑敤鎴峰悕",    
  •     byteRangeLength: "鐢ㄦ埛鍚嶅繀欏誨湪3-15涓瓧絎︿箣闂?涓涓腑鏂囧瓧綆?涓瓧絎?"    
  •    },    
  •    password: {    
  •     required: "璇峰~鍐欏瘑鐮?,    
  •     minlength: jQuery.format("杈撳叆{0}.")    
  •    },    
  •    repassword: {    
  •     required: "璇峰~鍐欑‘璁ゅ瘑鐮?,    
  •     equalTo: "涓ゆ瀵嗙爜杈撳叆涓嶇浉鍚?    
  •    },    
  •    question: {    
  •     required: "璇峰~鍐欐?zhèn)ㄧ殑瀵嗙爜鎻惤C洪棶棰?    
  •    },    
  •    answer: {    
  •     required: "璇峰~鍐欐?zhèn)ㄧ殑瀵嗙爜鎻惤C虹瓟妗?    
  •    },    
  •    realName: {    
  •     required: "璇峰~鍐欐?zhèn)ㄧ殑鐪熷疄濮撳?    
  •    },    
  •    email: {    
  •     required: "璇瘋緭鍏ヤ竴涓狤mail鍦板潃",    
  •     email: "璇瘋緭鍏ヤ竴涓湁鏁堢殑Email鍦板潃"    
  •    }    
  •   },    
  • /* 閿欒淇℃伅鐨勬樉紺轟綅緗?nbsp;*/    
  •   errorPlacement: function(error, element) {    
  •    error.appendTo( element.parent() );    
  •   },    
  • /* 楠岃瘉閫氳繃鏃剁殑澶勭悊 */    
  •   success: function(label) {    
  •    // set   as text for IE    
  •    label.html(" ").addClass("checked");    
  •   },    
  • /* 鑾峰緱鐒︾偣鏃朵笉楠岃瘉 */    
  •   focusInvalid: false,    
  •   onkeyup: false    
  • });    
  •   
  • // 杈撳叆妗嗚幏寰楃劍鐐規(guī)椂錛屾牱寮忚緗?nbsp;   
  • $('input').focus(function(){    
  •   if($(this).is(":text") || $(this).is(":password"))    
  •    $(this).addClass('focus');    
  •   if ($(this).hasClass('have_tooltip')) {    
  •    $(this).parent().parent().removeClass('field_normal').addClass('field_focus');    
  •   }    
  • });    
  •   
  • // 杈撳叆妗嗗け鍘葷劍鐐規(guī)椂錛屾牱寮忚緗?nbsp;   
  • $('input').blur(function() {    
  •   $(this).removeClass('focus');    
  •   if ($(this).hasClass('have_tooltip')) {    
  •    $(this).parent().parent().removeClass('field_focus').addClass('field_normal');    
  •   }    
  • });    
  • });   


  • ]]>
    jquery validate demohttp://www.aygfsteel.com/zuofei-bie/archive/2010/03/31/317063.html鍒槰闈?/dc:creator>鍒槰闈?/author>Wed, 31 Mar 2010 07:27:00 GMThttp://www.aygfsteel.com/zuofei-bie/archive/2010/03/31/317063.htmlhttp://www.aygfsteel.com/zuofei-bie/comments/317063.htmlhttp://www.aygfsteel.com/zuofei-bie/archive/2010/03/31/317063.html#Feedback0http://www.aygfsteel.com/zuofei-bie/comments/commentRss/317063.htmlhttp://www.aygfsteel.com/zuofei-bie/services/trackbacks/317063.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>jQuery validation plug-in - main demo</title>

    <link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />

    <script src="../lib/jquery.js" type="text/javascript"></script>
    <script src="../jquery.validate.js" type="text/javascript"></script>

    <script type="text/javascript">
    $.validator.setDefaults({
     submitHandler: function() { alert("submitted!"); }
    });

    $().ready(function() {
     // validate the comment form when it is submitted
     $("#commentForm").validate();
     
     // validate signup form on keyup and submit
     $("#signupForm").validate({
      rules: {
       firstname: "required",
       lastname: "required",
       username: {
        required: true,
        minlength: 2
       },
       password: {
        required: true,
        minlength: 5
       },
       confirm_password: {
        required: true,
        minlength: 5,
        equalTo: "#password"
       },
       email: {
        required: true,
        email: true
       },
       topic: {
        required: "#newsletter:checked",
        minlength: 2
       },
       agree: "required"
      },
      messages: {
       firstname: "Please enter your firstname",
       lastname: "Please enter your lastname",
       username: {
        required: "Please enter a username",
        minlength: "Your username must consist of at least 2 characters"
       },
       password: {
        required: "Please provide a password",
        minlength: "Your password must be at least 5 characters long"
       },
       confirm_password: {
        required: "Please provide a password",
        minlength: "Your password must be at least 5 characters long",
        equalTo: "Please enter the same password as above"
       },
       email: "Please enter a valid email address",
       agree: "Please accept our policy"
      }
     });
     
     // propose username by combining first- and lastname
     $("#username").focus(function() {
      var firstname = $("#firstname").val();
      var lastname = $("#lastname").val();
      if(firstname && lastname && !this.value) {
       this.value = firstname + "." + lastname;
      }
     });
     
     //code to hide topic selection, disable for demo
     var newsletter = $("#newsletter");
     // newsletter topics are optional, hide at first
     var inital = newsletter.is(":checked");
     var topics = $("#newsletter_topics")[inital ? "removeClass" : "addClass"]("gray");
     var topicInputs = topics.find("input").attr("disabled", !inital);
     // show when newsletter is checked
     newsletter.click(function() {
      topics[this.checked ? "removeClass" : "addClass"]("gray");
      topicInputs.attr("disabled", !this.checked);
     });
    });
    </script>

    <style type="text/css">
    #commentForm { width: 500px; }
    #commentForm label { width: 250px; }
    #commentForm label.error, #commentForm input.submit { margin-left: 253px; }
    #signupForm { width: 670px; }
    #signupForm label.error {
     margin-left: 10px;
     width: auto;
     display: inline;
    }
    #newsletter_topics label.error {
     display: none;
     margin-left: 103px;
    }
    </style>

    </head>
    <body>

    <h1 id="banner"><a >jQuery Validation Plugin</a> Demo</h1>
    <div id="main">

    <p>Default submitHandler is set to display an alert into of submitting the form</p>

    <form class="cmxform" id="commentForm" method="get" action="">
     <fieldset>
      <legend>Please provide your name, email address (won't be published) and a comment</legend>
      <p>
       <label for="cname">Name (required, at least 2 characters)</label>
       <input id="cname" name="name" class="required" minlength="2" />
      <p>
       <label for="cemail">E-Mail (required)</label>
       <input id="cemail" name="email" class="required email" />
      </p>
      <p>
       <label for="curl">URL (optional)</label>
       <input id="curl" name="url" class="url" value="" />
      </p>
      <p>
       <label for="ccomment">Your comment (required)</label>
       <textarea id="ccomment" name="comment" class="required"></textarea>
      </p>
      <p>
       <input class="submit" type="submit" value="Submit"/>
      </p>
     </fieldset>
    </form>

    <form class="cmxform" id="signupForm" method="get" action="">
     <fieldset>
      <legend>Validating a complete form</legend>
      <p>
       <label for="firstname">Firstname</label>
       <input id="firstname" name="firstname" />
      </p>
      <p>
       <label for="lastname">Lastname</label>
       <input id="lastname" name="lastname" />
      </p>
      <p>
       <label for="username">Username</label>
       <input id="username" name="username" />
      </p>
      <p>
       <label for="password">Password</label>
       <input id="password" name="password" type="password" />
      </p>
      <p>
       <label for="confirm_password">Confirm password</label>
       <input id="confirm_password" name="confirm_password" type="password" />
      </p>
      <p>
       <label for="email">Email</label>
       <input id="email" name="email" />
      </p>
      <p>
       <label for="agree">Please agree to our policy</label>
       <input type="checkbox" class="checkbox" id="agree" name="agree" />
      </p>
      <p>
       <label for="newsletter">I'd like to receive the newsletter</label>
       <input type="checkbox" class="checkbox" id="newsletter" name="newsletter" />
      </p>
      <fieldset id="newsletter_topics">
       <legend>Topics (select at least two) - note: would be hidden when newsletter isn't selected, but is visible here for the demo</legend>
       <label for="topic_marketflash">
        <input type="checkbox" id="topic_marketflash" value="marketflash" name="topic" />
        Marketflash
       </label>
       <label for="topic_fuzz">
        <input type="checkbox" id="topic_fuzz" value="fuzz" name="topic" />
        Latest fuzz
       </label>
       <label for="topic_digester">
        <input type="checkbox" id="topic_digester" value="digester" name="topic" />
        Mailing list digester
       </label>
       <label for="topic" class="error">Please select at least two topics you'd like to receive.</label>
      </fieldset>
      <p>
       <input class="submit" type="submit" value="Submit"/>
      </p>
     </fieldset>
    </form>

    <h3>Syntetic examples</h3>
    <ul>
     <li><a href="errorcontainer-demo.html">Error message containers in action</a></li>
     <li><a href="custom-messages-metadata-demo.html">Custom Messages as Metadata</a></li>
     <li><a href="radio-checkbox-select-demo.html">Radio and checkbox buttons and selects</a></li>
     <li><a href="ajaxSubmit-intergration-demo.html">Integration with Form Plugin (AJAX submit)</a></li>
     <li><a href="custom-methods-demo.html">Custom methods and message display.</a></li>
     <li><a href="dynamic-totals.html">Dynamic forms</a></li>
     <li><a href="themerollered.html">Forms styled with jQuery UI Themeroller</a></li>
    </ul>
    <h3>Real-world examples</h3>
    <ul>
     <li><a href="milk/">Remember The Milk signup form</a></li>
     <li><a href="marketo/">Marketo signup form</a></li>
     <li><a href="multipart/">Buy and Sell a House multipart form</a></li>
     <li><a href="captcha/">Remote captcha validation</a></li>
    </ul>

    <h3>Testsuite</h3>
    <ul>
     <li><a href="../test/">Validation Testsuite</a></li>
    </ul> 

    </div>

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-2623402-1";
    urchinTracker();
    </script>
    </body>
    </html>



    ]]>
    主站蜘蛛池模板: 清水河县| 朝阳市| 金秀| 神农架林区| 黑龙江省| 迁安市| 宣化县| 三原县| 铁岭县| 邳州市| 新乡县| 湾仔区| 大城县| 西丰县| 南昌市| 友谊县| 奉化市| 景东| 大城县| 碌曲县| 大埔区| 贵德县| 镇平县| 随州市| 龙岩市| 温宿县| 剑阁县| 青川县| 额济纳旗| 隆德县| 瑞金市| 石林| 肥西县| 绿春县| 伊金霍洛旗| 佛教| 繁昌县| 肥城市| 吉木萨尔县| 永新县| 炎陵县|