js验证


var regBox = {
regMoney:/^(([1-9]\d{0,9})|0)(\.\d{1,2})?$/,
}
var benefit_price = $("#benefit_price").val();
var price = $("#price").val();

if(benefit_price != null && benefit_price != ''){
benefit_price = parseInt(benefit_price);
}
if(price != null && price != ''){
price = parseInt(price);
}
//判断金额大小
if(!regBox.regMoney.test(benefit_price) || !regBox.regMoney.test(price) || benefit_price == '' || price == '') {
alert("请输入正确的金额数目");
return;
}
if(benefit_price<=price){
alert("优惠前价格必须大于实际价格");
return;
}

posted @ 2016-09-07 11:37  加洲旅馆2012  阅读(151)  评论(0编辑  收藏  举报
hello