日期:2014-05-16 浏览次数:20514 次
<SCRIPT LANGUAGE="JavaScript">
<!--
function formatFloat(src, pos)
{
return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
}
alert(formatFloat("1212.2323", 2));
//-->
</SCRIPT>
var test=88888.234;
 alert(test.toFixed(2)); 
// Float数据四舍五入到2位小数;
 function to2bits(flt) {
 if(parseFloat(flt) == flt)
 return Math.round(flt * 100) / 100;
 // 到4位小数, return Math.round(flt * 10000) / 10000;
 else
 return 0;
 }