JS文本框每隔4个数字加一个空格,银行卡号文本框

<input type="text" onkeypress="return (function(key,that){return (key>47&&key<58) && ((that.value.length%5==0)?that.value+=' ':1)})(event.keyCode,this)" />

demo: 

posted @ 2017-07-03 16:15  yzeng  阅读(398)  评论(0编辑  收藏  举报