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()
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()
相关文章推荐
- js将字符串转化成函数:eval(logOutCallbackFun+"()");
- js返回顶部封装 简洁
- js调试模式控制台输出信息
- web项目中js文件修改后不能自动编译的问题
- javascript模块化:立即执行函数(function(){…})()
- W3C JSon教程
- javascript 判断是否是数组
- javascript 利用hash实现行列转置
- js关闭当前窗口,window.close()方法只能是window.open打开的才能执行关闭
- js实现桌面通知
- js验证是否是数字,支持正负数小数
- Javascript诞生记
- 毫秒转换成js年月日时分秒,标准时间转换js
- ES 5、ES 6变量和函数声明以及作用域总结
- Javascriptl历史-继承机制的设计思想
- extjs和js定时器
- BSON与JSON的区别
- 原始js调用 选中事件
- js模拟键盘或遥控器操作(加强版)
- JS获取鼠标坐标位置实例分析