Foros del Web » Programando para Internet » Javascript »

Sumar columna formulario

Estas en el tema de Sumar columna formulario en el foro de Javascript en Foros del Web. Necesito ayuda no se de javascript y buscando en la web me tope con un script pero no me funciona, por cierto lo genero con ...
  #1 (permalink)  
Antiguo 18/06/2009, 09:25
 
Fecha de Ingreso: febrero-2007
Mensajes: 10
Antigüedad: 17 años, 3 meses
Puntos: 0
Sumar columna formulario

Necesito ayuda no se de javascript y buscando en la web me tope con un script pero no me funciona, por cierto lo genero con PHP el codigo es el siguiente

<form name="liq_CFLmeasures">
<tr class="valores">
<td align="center" class="dato">2009-04-13</td>
<td align="center" class="dato">2009-04-131310</td>
<td width="20" align="center">
<label>
<input name="CFLw0" type="text" id="CFLw0" size="1" maxlength="1" value="3" onChange="T_CFLw0.value=(CFLw0.value*F_CFLw0.value ).toFixed(2)" >
</label> </td>
<td align="right">
<label>
<input name="F_CFLw0" type="text" id="F_CFLw0" size="6" maxlength="6" onChange="T_CFLw0.value=(CFLw0.value*F_CFLw0.value ).toFixed(2);" onFocus="Sumar();" onBlur="NoSumar();" >
</label> </td>

<td align="right">
<label>
<input name="T_CFLw0" type="text" class="total" id="T_CFLw0" value="0.00" size="6" maxlength="6" readonly >
</label> </td>

</tr> <tr class="valores">
<td align="center" class="dato">2009-04-13</td>
<td align="center" class="dato">2009-04-131311</td>

<td width="20" align="center">
<label>
<input name="CFLw1" type="text" id="CFLw1" size="1" maxlength="1" value="17" onChange="T_CFLw1.value=(CFLw1.value*F_CFLw1.value ).toFixed(2)" >
</label> </td>
<td align="right">
<label>
<input name="F_CFLw1" type="text" id="F_CFLw1" size="6" maxlength="6" onChange="T_CFLw1.value=(CFLw1.value*F_CFLw1.value ).toFixed(2);" onFocus="Sumar();" onBlur="NoSumar();" >
</label> </td>

<td align="right">
<label>
<input name="T_CFLw1" type="text" class="total" id="T_CFLw1" value="0.00" size="6" maxlength="6" readonly >
</label> </td>

</tr> <tr class="valores">
<td align="center" class="dato">2009-04-13</td>
<td align="center" class="dato">2009-04-131312</td>

<td width="20" align="center">
<label>
<input name="CFLw2" type="text" id="CFLw2" size="1" maxlength="1" value="5" onChange="T_CFLw2.value=(CFLw2.value*F_CFLw2.value ).toFixed(2)" >
</label> </td>
<td align="right">
<label>
<input name="F_CFLw2" type="text" id="F_CFLw2" size="6" maxlength="6" onChange="T_CFLw2.value=(CFLw2.value*F_CFLw2.value ).toFixed(2);" onFocus="Sumar();" onBlur="NoSumar();" >
</label> </td>

<td align="right">
<label>
<input name="T_CFLw2" type="text" class="total" id="T_CFLw2" value="0.00" size="6" maxlength="6" readonly >
</label> </td>

</tr><br>


<script type="text/javascript">
function Sumar(){
interval = setInterval("calcular()",1);
}
function calcular(){

A = document.liq_CFLmeasures.T_CFLw0.value;

B = document.liq_CFLmeasures.T_CFLw1.value;

C = document.liq_CFLmeasures.T_CFLw2.value;

document.autoSumForm.L_CFLw.value=(A * 1)+(B * 1)+(C * 1);
}
function NoSumar(){
clearInterval(interval);
}
</script>

<tfoot>
<th colspan="4" scope="col" class="grande" >Total by CFL Measures</th>
<th class="titulo"><label>

<input name="L_CFLw" type="text" class="total" id="L_CFLw" value="0.00" size="8" maxlength="8" readonly >
</label> </th>
</tfoot>
</form>

este es el codigo
no se si este obligado a ponerlo en el header lo cual seria un problema porque como digo se genera en PHP luego de crear los campos correspondientes

Resumido lo que necesito es esto

CFLw0 * F_CFLw0 = T_CFLw0
CFLw1 * F_CFLw1 = T_CFLw1
CFLw2 * F_CFLw2 = T_CFLw2

Al final deseo se sumen en L_CFLw todos los T_CFLw


Saludos

erivier
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:49.