18/08/2005, 13:09
|
| | Fecha de Ingreso: agosto-2005
Mensajes: 104
Antigüedad: 19 años, 4 meses Puntos: 0 | |
este es el codigo :
<html>
<head>
<title>suma</title>
</head>
<body>
<form action="" method="get" name="form" id="form">
<table width="222">
<tr>
<td width="44">Precio</td>
<td width="69">Cantidad</td>
<td width="50">Subtotal</td>
</tr>
<?
$filas=4; // filas es variable
for($a=1; $a<$filas ; $a++)
{
?>
<tr>
<td><input name="p_costo<?php echo $a ; ?>" type="text" i size="6" >
</td> <td> <input name="cantidad<?php echo $a ; ?>" type="text" size="4" onKeyUp=" this.form.i_total<?php echo $a; ?>.value = this.form.p_costo<?php echo $a; ?>.value * this.form.cantidad<?php echo $a; ?>.value ;
var s = parseInt ( this.form.total.value ) ;
s =s + parseInt(this.form.i_total<?php echo $a; ?>.value);
this.form.total.value=s;
" >
</td>
<td> <input name="i_total<?php echo $a ; ?>" type="text" size="6" disabled >
</td>
</tr>
<?
}
?>
<!-- var a = this.form.total.value;
a = a + this.form.i_total<?php //echo $a; ?>.value;
this.form.total.value=a; -->
</table>
Total <input name="total" type="text" >
</form>
</body>
</html> |