输入框只能输入数字

输入框只能输入数字:

代码如下:

 <input id="amount" onkeyup="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" type="text" />


//成功一定有方法,失败一定有原因。
原文地址:https://www.cnblogs.com/webapi/p/2425858.html