javaScript中 toFixed() 方法将数字对象四舍五入为指定小数位数的数字
定义和用法
toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。
语法
NumberObject.toFixed(num)
实例
在本例中,我们将把数字舍入为仅有一位小数的数字:
<script type="text/javascript">
var num = new Number(13.37);
document.write (num.toFixed(1))
</script>

浙公网安备 33010602011771号