1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      jquery.validate使用

      JQuery Validate使用總結(jié):

      創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括靜寧網(wǎng)站建設(shè)、靜寧網(wǎng)站制作、靜寧網(wǎng)頁制作以及靜寧網(wǎng)絡(luò)營(yíng)銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,靜寧網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到靜寧省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

      一、導(dǎo)入js庫

      如果也導(dǎo)入 jquery.validate.unobtrusive可能會(huì)沖突驗(yàn)證沒有作用

      二、默認(rèn)校驗(yàn)規(guī)則

      (1)required:true               必輸字段

      (2)remote:"check.php"          使用ajax方法調(diào)用check.php驗(yàn)證輸入值

      (3)email:true                  必須輸入正確格式的電子郵件

      (4)url:true                    必須輸入正確格式的網(wǎng)址

      (5)date:true                   必須輸入正確格式的日期 日期校驗(yàn)ie6出錯(cuò),慎用

      (6)dateISO:true                必須輸入正確格式的日期(ISO),例如:2009-06-23,1998/01/22 只驗(yàn)證格式,不驗(yàn)證有效性

      (7)number:true                 必須輸入合法的數(shù)字(負(fù)數(shù),小數(shù))

      (8)digits:true                 必須輸入整數(shù)

      (9)creditcard:                 必須輸入合法的信用卡號(hào)

      (10)equalTo:"#field"           輸入值必須和#field相同

      (11)accept:                    輸入擁有合法后綴名的字符串(上傳文件的后綴)

      (12)maxlength:5                輸入長(zhǎng)度最多是5的字符串(漢字算一個(gè)字符)

      (13)minlength:10               輸入長(zhǎng)度最小是10的字符串(漢字算一個(gè)字符)

      (14)rangelength:[5,10]         輸入長(zhǎng)度必須介于 5 和 10 之間的字符串")(漢字算一個(gè)字符)

      (15)range:[5,10]               輸入值必須介于 5 和 10 之間

      (16)max:5                      輸入值不能大于5

      (17)min:10                     輸入值不能小于10

       

      三、默認(rèn)的提示

      messages: {

          required: "This field is required.",

          remote: "Please fix this field.",

          email: "Please enter a valid email address.",

          url: "Please enter a valid URL.",

          date: "Please enter a valid date.",

          dateISO: "Please enter a valid date (ISO).",

          dateDE: "Bitte geben Sie ein g眉ltiges Datum ein.",

          number: "Please enter a valid number.",

          numberDE: "Bitte geben Sie eine Nummer ein.",

          digits: "Please enter only digits",

          creditcard: "Please enter a valid credit card number.",

          equalTo: "Please enter the same value again.",

          accept: "Please enter a value with a valid extension.",

          maxlength: $.validator.format("Please enter no more than {0} characters."),

          minlength: $.validator.format("Please enter at least {0} characters."),

          rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),

          range: $.validator.format("Please enter a value between {0} and {1}."),

          max: $.validator.format("Please enter a value less than or equal to {0}."),

          min: $.validator.format("Please enter a value greater than or equal to {0}.")

      },

      如需要修改,可在js代碼中加入:

      jQuery.extend(jQuery.validator.messages, {

              required: "必選字段",

        remote: "請(qǐng)修正該字段",

        email: "請(qǐng)輸入正確格式的電子郵件",

        url: "請(qǐng)輸入合法的網(wǎng)址",

        date: "請(qǐng)輸入合法的日期",

        dateISO: "請(qǐng)輸入合法的日期 (ISO).",

        number: "請(qǐng)輸入合法的數(shù)字",

        digits: "只能輸入整數(shù)",

        creditcard: "請(qǐng)輸入合法的信用卡號(hào)",

        equalTo: "請(qǐng)?jiān)俅屋斎胂嗤闹?,

        accept: "請(qǐng)輸入擁有合法后綴名的字符串",

        maxlength: jQuery.validator.format("請(qǐng)輸入一個(gè) 長(zhǎng)度最多是 {0} 的字符串"),

        minlength: jQuery.validator.format("請(qǐng)輸入一個(gè) 長(zhǎng)度最少是 {0} 的字符串"),

        rangelength: jQuery.validator.format("請(qǐng)輸入 一個(gè)長(zhǎng)度介于 {0} 和 {1} 之間的字符串"),

        range: jQuery.validator.format("請(qǐng)輸入一個(gè)介于 {0} 和 {1} 之間的值"),

        max: jQuery.validator.format("請(qǐng)輸入一個(gè)最大為{0} 的值"),

        min: jQuery.validator.format("請(qǐng)輸入一個(gè)最小為{0} 的值")

      });

      推薦做法,將此文件放入messages_cn.js中,在頁面中引入

      四、使用方式1.將校驗(yàn)規(guī)則寫到控件中

      $().ready(function() {

       $("#signupForm").validate();

      });

         

             

             

         

       

       

       

       

       

       

       

       

       

       

       

       

         

             

         

      使用class="{}"的方式,必須引入包:jquery.metadata.js

      可以使用如下的方法,修改提示內(nèi)容:

      class="{required:true,minlength:5,messages:{required:'請(qǐng)輸入內(nèi)容'}}"

      在使用equalTo關(guān)鍵字時(shí),后面的內(nèi)容必須加上引號(hào),如下代碼:

      class="{required:true,minlength:5,equalTo:'#password'}"

       

       

      2.將校驗(yàn)規(guī)則寫到j(luò)s代碼中

      $().ready(function() {

       $("#signupForm").validate({

              rules: {

         firstname: "required",

         email: {

          required: true,

          email: true

         },

         password: {

          required: true,

          minlength: 5

         },

         confirm_password: {

          required: true,

          minlength: 5,

          equalTo: "#password"

         }

        },

              messages: {

         firstname: "請(qǐng)輸入姓名",

         email: {

          required: "請(qǐng)輸入Email地址",

          email: "請(qǐng)輸入正確的email地址"

         },

         password: {

          required: "請(qǐng)輸入密碼",

          minlength: jQuery.format("密碼不能小于{0}個(gè)字 符")

         },

         confirm_password: {

          required: "請(qǐng)輸入確認(rèn)密碼",

          minlength: "確認(rèn)密碼不能小于5個(gè)字符",

          equalTo: "兩次輸入密碼不一致不一致"

         }

        }

          });

      });

      //messages處,如果某個(gè)控件沒有message,將調(diào)用默認(rèn)的信息

         

             

             

         

       

       

       

       

       

       

       

       

       

       

       

       

         

             

         

      required:true 必須有值

      required:"#aa:checked"表達(dá)式的值為真,則需要驗(yàn)證

      required:function(){}返回為真,表時(shí)需要驗(yàn)證

      后邊兩種常用于,表單中需要同時(shí)填或不填的元素

      demo:

      $("#form1").validate({//JQ 前端校驗(yàn)

                              rules: {

                              ctl00$MainContent$txtWebName: {

                                      required: true,

                                      maxlength: 500

                              },

                              ctl00$MainContent$txtShortName: {

                                      maxlength: 500,

                                      required: false

                              },

                              ctl00$MainContent$txtKeyWords: {

                                      required: false,

                                      maxlength: 500

                              },

                              ctl00$MainContent$txtGoodsNo: {

                                      required: false,

                                      maxlength: 250

                              },

                              ctl00$MainContent$txtRemark: {

                                      required: false,

                                      maxlength: 500

                              },

                              ctl00$MainContent$txtPageTitle: {

                                      required: true,

                                      maxlength: 1000

                              },

                              ctl00$MainContent$txtMetaKey: {

                                      required: false,

                                      maxlength: 1000

                              },

                              ctl00$MainContent$txtShowUrl: {

                                      required: false,

                                      maxlength: 2000,

                                      url: true

                              },

                              ctl00$MainContent$txtOtherData: {

                                      required: false,

                                      maxlength: 1000

                              },

                              ctl00$MainContent$txtEC :{ required: true, digits: true},

                              ctl00$MainContent$txtFullEP : {required: true, digits: true},

                              ctl00$MainContent$txtMarketPrice : {required: true, number:true},

                              ctl00$MainContent$txtCash : {required: true,number:true},

                              ctl00$MainContent$txtDurationDays:{required: false,number:true},

                              ctl00$MainContent$txtFullCash:{required: true,number:true}

                              },

                              messages: {

                              ctl00$MainContent$txtWebName: "*請(qǐng)輸入商品名[限500字以內(nèi)]",

                              ctl00$MainContent$txtShortName: "*限500字以內(nèi)",

                              ctl00$MainContent$txtKeyWords: "*500字以內(nèi)",

                              ctl00$MainContent$txtGoodsNo: "*250字以內(nèi)",

                              ctl00$MainContent$txtRemark: "*500字以內(nèi)",

                              ctl00$MainContent$txtPageTitle: "*請(qǐng)輸入分類頁面的標(biāo)題",

                              ctl00$MainContent$txtMetaKey: "*1000字以內(nèi)",

                              ctl00$MainContent$txtShowUrl: "*請(qǐng)輸入正確的URL地址",

                              ctl00$MainContent$txtOtherData: "*1000字以內(nèi)",

                              ctl00$MainContent$txtEC:"*只能輸入整數(shù)",

                              ctl00$MainContent$txtFullEP:"*只能輸入整數(shù)",

                              ctl00$MainContent$txtCash:"*請(qǐng)輸入正確的現(xiàn)金數(shù)",

                              ctl00$MainContent$txtFullCash:"*請(qǐng)輸入正確的現(xiàn)金數(shù)",

                              ctl00$MainContent$txtDurationDays:"必須輸入數(shù)字",

                              ctl00$MainContent$txtMarketPrice:"*請(qǐng)輸入正確的市場(chǎng)價(jià)格"

                              }

                      }); //validate

      自定義驗(yàn)證規(guī)則

      jQuery.validator.addMethod("gt", function (value, element, param) {

                      var r = ($("#abc").val()=="abc");

                      return r;

                  }, $.validator.format("輸入值必須大于{0}!"));


      網(wǎng)站名稱:jquery.validate使用
      標(biāo)題路徑:http://ef60e0e.cn/article/piccdc.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        正定县| 三亚市| 阿坝县| 集贤县| 邛崃市| 军事| 寻乌县| 霍邱县| 喀喇沁旗| 田林县| 咸宁市| 曲松县| 蕲春县| 措美县| 沁源县| 古田县| 额尔古纳市| 洪湖市| 康平县| 龙海市| 平邑县| 于都县| 巫溪县| 黄大仙区| 远安县| 盘山县| 彭阳县| 二手房| 凉城县| 务川| 芒康县| 垫江县| 东城区| 芜湖县| 竹北市| 亳州市| 老河口市| 西乌| 文山县| 晋城| 灵武市|