t=Math.round(t*100)/100;
alert(t);

解决方案 »

  1.   

    value=Math.round(value*100)/100;
      

  2.   

    <script language=JavaScript>
    function tofloat(f,dec) { 
    if(dec<0) return "Error:dec<0!"; 
    result=parseInt(f)+(dec==0?"":"."); 
    f-=parseInt(f); 
    if(f==0) 
    for(i=0;i<dec;i++) result+='0'; 
    else { 
    for(i=0;i<dec;i++) f*=10; 
    result+=parseInt(Math.round(f)); 

    return result; 

    alert(tofloat(11.20000000000000000001,2))
    </script>
      

  3.   

    function roundFun(numberRound,roundDigit) 
    {
      with(Math){
        return round(numberRound*pow(10,roundDigit))/pow(10,roundDigit);
      }
    }alert(roundFun(1112.01111,-2));//精度为:100
    alert(roundFun(1112.01111,2));//精度为:0.01