
30/01/2004, 01:50
|
 | | | Fecha de Ingreso: enero-2003 Ubicación: Gerli, Avellaneda
Mensajes: 543
Antigüedad: 22 años, 1 mes Puntos: 4 | |
Y el script: script.js
Código:
//---------------------------**
//CÁLCULOS DEL FORM DE PEDIDO**
//---------------------------**
function redondear(cant, dec) {
var cant = parseFloat(cant);
var dec = parseFloat(dec);
dec = (!dec ? 2 : dec);
return Math.round(cant * Math.pow(10, dec)) / Math.pow(10, dec);
}
function comprar(form) {
a=0; b=0; c=0; d=0; e=0; f=0;
a1=0; b1=0; c1=0; d1=0; e1=0; f1=0;
if(form.c1.checked == true) { a = parseFloat(27.64); a1 = parseFloat(7.35); form.cf1.value = a; }
else { a = 0; a1 = 0; form.cf1.value = a; }
if(form.c2.checked == true) { b = parseFloat(11.81); b1 = parseFloat(3.14); form.cf2.value = b; }
else { b = 0; b1 = 0; form.cf2.value = b; }
if(form.c3.checked == true) { c = parseFloat(20.53); c1 = parseFloat(5.46); form.cf3.value = c; }
else { c = 0; c1 = 0; form.cf3.value = c; }
if(form.c4.checked == true) { d = parseFloat(30.80); d1 = parseFloat(8.19); form.cf4.value = d; }
else { d = 0; d1 = 0; form.cf4.value = d; }
if(form.c5.checked == true) { e = parseFloat(78.21); e1 = parseFloat(20.79); form.cf5.value = e; }
else { e = 0; e1 = 0; form.cf5.value = e; }
if(form.c6.checked == true) { f = parseFloat(5.52); f1 = parseFloat(1.47); form.cf6.value = f; }
else { f = 0; f1 = 0; form.cf6.value = f; }
g = a+b+c+d+e+f;
h = a1+b1+c1+d1+e1+f1;
i = g+h;
form.cf.value = redondear(g, 2);
form.iva.value = redondear(h, 2);
form.tot.value = redondear(i, 2);
}
|