Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/06/2010, 19:47
bjorktoy
 
Fecha de Ingreso: junio-2010
Mensajes: 2
Antigüedad: 13 años, 10 meses
Puntos: 0
Ayuda suma y multiplicacion

Hola amigos, estoy fabricando un formulario de pedido, peor no he podido resolver la suma y la multiplicacion...

Todos los items los recogere despues con un php y los enviare a un correo. Espero puedan ayudarme

Código:
<html>
<head>
<title></title>
<script>

function calculo(cantidad,precio,inputtext){
	subtotal = cantidad*precio;
	inputtext.value=subtotal;

}
</script>
<body>
<blockquote>
  <form>
  <tr><td><table width="29%" border="0">
      <tr>
        <td width="10%">Cantidad</td>
        <td width="25%">Producto</td>
        <td width="12%">Valor</td>
        <td width="53%">Total</td>
      </tr>
      <tr>
        <td><input name="Cantidad1" type="text" id="cantidad"  onChange="calculo(this.value,valor.value,subtotal,total);" value="0" size="5"></td>
        <td><input name="Producto1" type="text" id="producto"  size="50"></td>
        <td><input name="Valor1"    type="text" id="valor"     onChange="calculo(this.value,valor.value,subtotal,total);" size="10"></td>
        <td><input name="subtotal1" type="text" id="subtotal"  disabled="disabled" value="0" size="10"></td>
      </tr>
      <tr>      </tr>
      <tr>
        <td><input name="Cantidad2" type="text" id="cantidad"  onChange="calculo(this.value,valor.value,subtotal,total);" value="0" size="5"></td>
        <td><input name="Producto2" type="text" id="Producto"  size="50"></td>
        <td><input name="Valor2"    type="text" id="valor"     onChange="calculo(this.value,valor.value,subtotal,total);" size="10"></td>
        <td><input name="subtotal2" type="text" id="subtotal"  disabled="disabled" value="0" size="10"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><input name="text3" type="text" id="total" value="0" size="10"></td>
      </tr>
    </table>
    </td>
  </tr>
  </form>
</blockquote>
</body>
</html>