input只能输入数字 1、设置input的值 onkeyup="this.value = this.value.replace(/[^d.]/g,'');" 2、设置input的type type = "number";