posts - 41, comments - 15, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
             $j.fn.numeral = function() {
                  $j(this).css("ime-mode", "disabled");
                  this.bind("keypress",function() {
                      if (event.keyCode == 46) {
                          if (this.value.indexOf(".") != -1) {
                              return false;
                          }
                      } else {
                          return event.keyCode >= 46 && event.keyCode <= 57;
                      }
                  });
                  this.bind("blur", function() {
                      if (this.value.lastIndexOf(".") == (this.value.length - 1)) {
                          this.value = this.value.substr(0, this.value.length - 1);
                      } else if (isNaN(this.value)) {
                          this.value = "";
                      }
                  });
                  this.bind("paste", function() {
                      var s = clipboardData.getData('text');
                      if (!/\D/.test(s));
                      value = s.replace(/^0*/, '');
                      return false;
                  });
                  this.bind("dragenter", function() {
                      return false;
                  });
                  this.bind("keyup", function() {
                  if (/(^0+)/.test(this.value)) {
                      this.value = this.value.replace(/^0*/, '');
                      }
                  });
              };

          評論

          # 呵呵呵  回復(fù)  更多評論   

          2013-07-28 11:36 by 急急急
          級經(jīng)濟環(huán)境

          # re: jquery實現(xiàn)文本框只能輸入數(shù)字函數(shù)[未登錄]  回復(fù)  更多評論   

          2014-06-04 18:29 by 1
          1

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 大冶市| 潍坊市| 九寨沟县| 勃利县| 财经| 武宣县| 凤城市| 乐至县| 新乐市| 朝阳区| 泰州市| 漳州市| 石城县| 郯城县| 余干县| 如皋市| 亚东县| 马山县| 宿州市| 莎车县| 玉林市| 内黄县| 怀仁县| 湟源县| 博罗县| 中阳县| 石屏县| 青冈县| 咸宁市| 滦平县| 古蔺县| 井陉县| 龙山县| 金沙县| 三河市| 孟津县| 泌阳县| 双桥区| 宜良县| 山阳县| 哈尔滨市|