JS控制小数位数

1 var $qtyValue = 5.8578;
2 $qtyValue = parseInt($qtyValue);
3 //toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。
4 var num = new Number($qtyValue);
5 alert(num.toFixed(2)); //out 5.86
View Code

 

posted @ 2015-05-04 14:48  wolf_cub  阅读(133)  评论(0编辑  收藏  举报