~~~ /* * 检验金额 */ var checkMoney = function(money) { if (money == '') { return false; } money = money.replace(/(^\s*)|(\s*$)/g, ""); var reg = /^[0-9]*\.?[0-9]{0,2}$/; if (!checkNum(money)) { return false; } if (money.length > 3) { if (money.substr(0, 1) == "0") { if (money.substr(3, money.length).length > 2) { return false; } } } if(!reg.test(money)){ return false; } return true; } ~~~