As shown below:
Copy code code as follows:
// Keep 2 digits after the decimal point
Function Disposenumber (Value) {
if (value == null || value == "") {{
Return 0;
} else if (value.tostring (). Indexof (".") == -1) {
Return value;
} Else {
Return Round (value, 2);
}
}
Function Round (v, E) {
var t = 1;
for (; e> 0; t*= 10, e--);
for (; e <0; t/= 10, e ++);
Return math.round (v*t)/t;
}