匹配整数和小数点 1、匹配正数和小数点 onkeyup="value=value.replace(/[^d.]/g,'')" 2、匹配正数、负数和小数点 onkeyup="value=value.replace(/[^-?d.]/g,'')"