input只允许输入正整数

onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                  onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}"

posted on 2018-08-31 14:23  Just丶随心  阅读(204)  评论(0编辑  收藏  举报

导航