Copiar código del código de la siguiente manera:
<Script language = "javaScript">
<!-
Formatfloat de función (SRC, POS)
{{
Return math.round (src*math.pow (10, pos))/math.pow (10, pos);
}
alerta (formatfloat ("1212.2323", 2);
//->
</script>
Hay varias maneras de la siguiente manera:
Copiar código del código de la siguiente manera:
prueba var = 88888.234;
alerta (test.tofixed (2));
// Flotar datos cuatro conjuntos y cinco intectives en 2 números decimales;
Función to2bits (flt) {
If (parsefloat (flt) == flt)
Return math.round (flt * 100) / 100;
// a 4 dígitos, return Math.round (FLT * 10000) / 10000;
demás
Regresar 0;
}