如何让整数也保留2位小数(678变成678.00)
谢谢阿 !1

解决方案 »

  1.   

    '数字千位逗号格式化
    Function Format_Number(Num)
    IF  Num<>"" And Num>0 Then
    Format_Number=FormatNumber(Num,0)'这里面的 0  代表小数位数
    Else
    Format_Number=0
    End IF
    End Function'钱币千位逗号格式化
    Function Format_Price(Num,N)
    IF Num<>"" And Num>0 Then
    Format_Price=FormatNumber(Num,N,-1)
    Else
    Format_Price=0
    End IF
    End Function上面是我再用的两个函数,可以改写合并到一起
      

  2.   

    我记得我自己写函数的原因是,如果空数据直接使用FormatNumber函数会报错。用判断没有用函数好。
      

  3.   

    var a=678
    alert(a.toFixed(2));
      

  4.   

    var a=678
    alert(a.toFixed(2));
      

  5.   

    var   a=678 
    alert(a.toFixed(2));
    正解