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ù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      jquery數(shù)據(jù)驗證插件(自制,簡單,練手)實例代碼

      最近項目中js數(shù)據(jù)驗證比較多,為了統(tǒng)一風(fēng)格,移植復(fù)用,于是順手封裝了Jquery的插件

      代碼如下:

      (function($) {
      var defaults = {
      bugColor: '#FFCCCC', //數(shù)據(jù)有誤的時候文本框顏色
      color: 'white', //數(shù)據(jù)正確時候文本框顏色
      type: "alert", //數(shù)據(jù)錯誤時候提示方式 alert 彈出框方式 text 賦值span html
      msg: "Msg", //數(shù)據(jù)有誤的時候提示內(nèi)容
      ResOjId: 'no'// 當(dāng)test方式的時候 被賦值的標(biāo)簽 #id
      };
      function UiProcess(options, rexString, object) {
      var options = $.extend(defaults, options);
      var values = object.val();
      if (rexString.test(values)) {
      object.css("backgroundColor", options.color);
      return true;
      } else {
      object.css("backgroundColor", options.bugColor);
      if (options.type == "alert") {
      alert(options.msg);
      }
      if (options.type == "text") {
      $(options.ResOjId).html(options.msg);
      }
      return false;
      }
      }
      //驗證ip是否符合格式
      $.fn.RegIp = function(options) {
      var rexString = /^\d{1,3}\.{1}\d{1,3}\.{1}\d{1,3}/;
      return UiProcess(options, rexString, this)
      }
      //驗證座機是否符合格式
      $.fn.RegTelPhone = function(options) {
      var rexString = /^[0-9]+[-]?[0-9]+[-]?[0-9]$/;
      return UiProcess(options, rexString, this)

      }
      //驗證手機是否符合格式
      $.fn.RegMombilePhone = function(options) {
      var rexString = /(^189\d{8}$)|(^13\d{9}$)|(^15\d{9}$)/;
      return UiProcess(options, rexString, this)

      }
      //驗證中文是否符合格式
      $.fn.RegCHZN = function(options) {
      var rexString = /[\u4e00-\u9fa5]/;
      return UiProcess(options, rexString, this)

      }
      //驗證decimal是否符合格式
      $.fn.RegDecimal = function(options) {
      var rexString = /^[0-9]+[.]?[0-9]+$/;
      return UiProcess(options, rexString, this)

      }
      //驗證decimal保留一位小數(shù)是否符合格式
      $.fn.RegDecimalSign = function(options) {
      var rexString = /^[+-]?[0-9]+[.]?[0-9]+$/;
      return UiProcess(options, rexString, this)

      }
      //驗證整數(shù)保留一位小數(shù)是否符合格式
      $.fn.RegNumber = function(options) {
      var rexString = /^[0-9]+$/;
      return UiProcess(options, rexString, this)

      }
      //驗證各位整數(shù)保留一位小數(shù)是否符合格式
      $.fn.RegNumberSign = function(options) {
      var rexString = /^[+-]?[0-9]+$/;
      return UiProcess(options, rexString, this)

      }
      //驗證非空字符
      $.fn.IsEmpty = function(options) {
      var rexString = /(^.+$)|([\u4e00-\u9fa5])/;
      return UiProcess(options, rexString, this)

      }
      })(jQuery);

      調(diào)用:

      代碼如下:

      公司主營業(yè)務(wù):成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè)、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。成都創(chuàng)新互聯(lián)公司是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。成都創(chuàng)新互聯(lián)公司推出禹會免費做網(wǎng)站回饋大家。

      unity3d http://www.unitymanual.com


      分享文章:jquery數(shù)據(jù)驗證插件(自制,簡單,練手)實例代碼
      文章來源:http://www.ef60e0e.cn/article/gsjecj.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>

        广宁县| 腾冲县| 宁海县| 区。| 松桃| 隆安县| 石河子市| 柳林县| 延庆县| 宣化县| 育儿| 伊川县| 青河县| 神农架林区| 香河县| 西藏| 宣汉县| 碌曲县| 十堰市| 九龙县| 房产| 吉木萨尔县| 山西省| 久治县| 历史| 惠东县| 沂源县| 平顺县| 穆棱市| 沧州市| 井陉县| 金昌市| 新宁县| 滁州市| 兖州市| 嘉兴市| 鹤山市| 永平县| 沐川县| 天水市| 合水县|