方法一:
<input id="xxx" type="number" onKeypress="return (/[d]/.test(String.fromCharCode(event.keyCode)))"> 可以过滤
方法二:
<input id="xxx" type="number" onkeyup="this.value=this.value.replace(/[^.d]/g,'');this.value=this.value.replace(/D|^0/g,'');this.value=this.value.replace('.','');" >