jquery銀行電子賬單表格填入和編輯

來源:互聯網
上載者:User

標籤:style   blog   io   ar   os   java   sp   for   資料   

jquery銀行電子賬單表格填入和編輯

前段時間做的一個銀行表格賬單的jquery外掛程式,用於金額寫入和編輯的應用,希望對大家有所協助,發現問題歡迎回複
;(function($){ function getNum(num) {        num += ‘‘;        var num1 = num.replace(/[^0-9|\.]/g, ‘0‘);//清除字串中的非數字非.字元          if (/^0+/) //清除字串開頭的0              num1 = num1.replace(/^0+/, ‘‘);        if (/^\./.test(num1)) //字元以.開頭時,在開頭添加0              num1 = ‘0‘ + num1;        num1 = new Number(num1);        num1 = num1.toFixed(2);//四捨五入保留最後兩位元        return num1;    }$.fn.trSet=function(options){var options=$.extend(this,options);this.each(function(){var _this=$(this);_this.find(options.trCom).on(options.elemType,function(){var _thisTrTd=$(this).find(options.trTd),_trTdPop=$(this).find(options.trTdPop),_trTdPicTxt=_trTdPop.find(options.trTdPicTxt),_thisTdText=_thisTrTd.text();_thisTdText=$.trim(_thisTdText);_thisTdText=getNum(_thisTdText),_thisTop=$(this).position().top,//當前tr距離父表單距離_thisW=$(this).width()-5,_thisH=$(this).height()-5;_trTdPicTxt.val(_thisTdText/100); //調用資料處理函數_trTdPop.css({"display":"block","position":"absolute","top":_thisTop,"left":"0"});_trTdPicTxt.css({"width":_thisW,"height":_thisH});_trTdPicTxt.on(options.elemType,function(){return false});_trTdPicTxt.trigger("focus");_trTdPicTxt.blur(function(){var _thisVal=$(this).val();_thisVal=getNum(_thisVal);//調用資料處理函數_thisVal=_thisVal.split("");_thisVal.splice($.inArray(".",_thisVal),1);//去掉小數點_thisTrTd.text("");var j=parseInt(_thisTrTd.length-_thisVal.length);for(var i=0;i<_thisVal.length;i++){//資料填入儲存格,位元匹配_thisTrTd.eq(j+i).text(_thisVal[i]);}_trTdPop.css("display","none");})})})}})(jQuery);$(function(){$("#getMoney").trSet({trCom:".trCom",trTd:".tdNum",trTdPop:".pupTxt1",trTdPicTxt:".picTxt",elemType:"click"});})

  

億 千 百 十 萬 千 百 十 元 角 分
                     
                     

jquery銀行電子賬單表格填入和編輯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.