您的位置:首页 > Web前端 > JavaScript

jsp 字符串转整形/浮点型

2016-01-20 16:12 621 查看
1、字符串转int型:parseInt()

var perAmount = $("input[name=perAmount]").val();

var totalAmount = $("input[name=totalAmount]").val();

if(totalAmount===""||parseInt(totalAmount)===0){

alert("募集规模不能为空或等于0!");

return false;

}

if(parseInt(perAmount)>=parseInt(totalAmount)){

alert("每期金额需小于募集规模!");

return false;

}

2、字符串转float型:parseFloat()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: