js中可以使用Math.round实现整数的四舍五入,如果需要实现精确到小数点多少位则需要编写函数了。
function ForDight(Dight,How) { Dight = Math.round(Dight*Math.pow(10,How))/Math.pow(10,How); return Dight; }
本文转载自<这一技客> http://www.geekso.com/
posted on 2010-03-22 09:43 Snowwolf 阅读(156) 评论(0) 编辑 收藏 举报