Copy code code as follows:
<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>
There are several ways as follows:
Copy code code as follows:
var test = 88888.234;
alert (test.tofixed (2));
// Float Data Four Sets and Five Intectives into 2 decimal numbers;
Function to2bits (FLT) {
If (PARSEFLOAT (FLT) == FLT)
Return math.round (FLT * 100) / 100;
// to 4 digits, Return math.round (FLT * 10000) / 10000;
else
Return 0;
}