1.限制输入内容为正整数
value = value.replace(/^(0+)|[^\d]+/g,'');
2.限制输入内容为正小数,开头不为小数点,只能有一个小数点,小数位数为2位
value = value.replace(/[^0-9.]/g,'');
value = value.replace(/^\./g, ""); //验证第一个字符是数字而不是小数点
value = value(".", "$#$").replace(/\./g, "").replace("$#$", "."); //只保留第一个小数点, 清除多余的
value = value.replace(/^(\-)*(\d+)\.(\d{2}).*$/, '$1$2.$3'); //只能输入2个小数