input只能输入数字

1、设置input的值

onkeyup="this.value = this.value.replace(/[^d.]/g,'');"

2、设置input的type

type = "number";

原文地址:https://www.cnblogs.com/ki16/p/14755509.html