1.設置input類型爲number,設置之後,input只能輸入數字,但是能輸入負數
2.在input屬性中添加,onkeyup="this.value=this.value.replace(/\D/g,"");",設置後,input只能輸入大於0的整數
3.在input屬性中添加,onkeyup="this.value=this.value.replace(/[^\d.]/,'')",設置後,input只能輸入大於0的數字,包含小數
1.設置input類型爲number,設置之後,input只能輸入數字,但是能輸入負數
2.在input屬性中添加,onkeyup="this.value=this.value.replace(/\D/g,"");",設置後,input只能輸入大於0的整數
3.在input屬性中添加,onkeyup="this.value=this.value.replace(/[^\d.]/,'')",設置後,input只能輸入大於0的數字,包含小數