Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/08/2011, 12:11
cipilusca
 
Fecha de Ingreso: agosto-2011
Mensajes: 1
Antigüedad: 12 años, 8 meses
Puntos: 0
Pregunta como insertar un boton para enviar un formulario javascript

Tengo el siguiente formulario de productos con los precios, subtotales y total final y quiero enviar la informacion para que me llegue a mi mail par ver lo que ha pedido el cliente. Podrian ayudarme a insertar el boton de envio que recopile toda la informacion sobre el producto elegido, la cantidad y el precio final. Este es el codigo donde he insertado un boton Enviar pero no me llega nada en el mail, me llega vacio.

<head>
<script>

function calculo(cantidad,precio,inputtext,totaltext){

gndtotal= totaltext.value-inputtext.value;


/* Parametros:
cantidad - entero con la cantidad
precio - entero con el precio
inputtotal - nombre del elemento del formulario donde ira el total
*/

// Calculo del subtotal
subtotal = precio*cantidad;
inputtext.value=subtotal;



//Actualizar el total
// Utilizamos el eval. Ya que el valor es un texto y si lo tratamos como tal
// es como si estuviesemos manipulando una cadena.
total = eval(gndtotal);
totaltext.value = total + subtotal;
}

</script>
</head>


<body>
<form action="mailto:[email protected]" method="get" enctype="text/plain">

<table width="620" height="319">
<tr>
<td width="168"></td>
<td width="92">Cantidad</td>
<td width="106">Precio</td>
<td width="327">Total</td>
</tr>
<tr>
<td>Platanos</td>
<td> <input type="text" size="3" id="platanos" value="0" onChange="calculo(this.value,precioplatanos.value, totalplatanos,total);" />
kg.</td>
<td> <input type="hidden" id="precioplatanos" value="1.6"/>
1,6</td>
<td> <input type="text" size="8" id="totalplatanos" value="0" />
€ </td>
</tr>
<tr>
<td>Manzanas</td>
<td> <input type="text" size="3" id="manzanas" value="0" onChange="calculo(this.value,preciomanzanas.value, totalmanzanas,total);" />
kg.</td>
<td> <input type="hidden" id="preciomanzanas" value="3"/>
3 </td>
<td><input type="text" size="8" id="totalmanzanas" value="0" />
€ </td>
</tr>
<tr>
<td>Peras</td>
<td> <input type="text" size="3" id="peras" value="0" onChange="calculo(this.value,precioperas.value,tot alperas,total);" />
kg.</td>
<td> <input type="hidden" id="precioperas" value="2"/>
2</td>
<td> <input type="text" size="8" id="totalperas" value="0" />
€ </td>
</tr>
<tr>
<td>Uvas</td>
<td> <input type="text" size="3" id="uvas" value="0" onChange="calculo(this.value,preciouvas.value,tota luvas,total);" />
kg.</td>
<td> <input type="hidden" id="preciouvas" value="9"/>
9</td>
<td> <input type="text" size="8" id="totaluvas" value="0" />
€ </td>
</tr>
<tr>
<td>Mel&oacute;n</td>
<td> <input type="text" size="3" id="melon" value="0" onChange="calculo(this.value,preciomelon.value,tot almelon,total);" />
pieza</td>
<td><input type="hidden" id="preciomelon" value="4"/>
4 </td>
<td> <input type="text" size="8" id="totalmelon" value="0" />€</td>
</tr>
<tr>
<td>Melocotones</td>
<td><input type="text" size="3" id="melocotones2" value="0" onChange="calculo(this.value,preciomelocotones.val ue,totalmelocotones,total);" />
kg.</td>
<td><input type="hidden" id="preciomelocotones2" value="5"/>
5</td>
<td><input type="text" size="8" id="totalmelocotones2" value="0" />
&euro;</td>
</tr>
<tr>
<td>Melocotones</td>
<td><input type="text" size="3" id="melocotones3" value="0" onChange="calculo(this.value,preciomelocotones.val ue,totalmelocotones,total);" />
kg.</td>
<td><input type="hidden" id="preciomelocotones3" value="5"/>
5</td>
<td><input type="text" size="8" id="totalmelocotones3" value="0" />
&euro;</td>
</tr>
<tr>
<td>Melocotones</td>
<td><input type="text" size="3" id="melocotones4" value="0" onChange="calculo(this.value,preciomelocotones.val ue,totalmelocotones,total);" />
kg.</td>
<td><input type="hidden" id="preciomelocotones4" value="5"/>
5</td>
<td><input type="text" size="8" id="totalmelocotones4" value="0" />
&euro;</td>
</tr>
<tr>
<td>Melocotones</td>
<td><input type="text" size="3" id="melocotones5" value="0" onChange="calculo(this.value,preciomelocotones.val ue,totalmelocotones,total);" />
kg.</td>
<td><input type="hidden" id="preciomelocotones5" value="5"/>
5</td>
<td><input type="text" size="8" id="totalmelocotones5" value="0" />
&euro;</td>
</tr>
<tr>
<td>Cebolla</td>
<td><input type="text" size="3" id="cebolla" value="0" onChange="calculo(this.value,preciocebolla.value,t otalcebolla,total);" />
kg.</td>
<td><input type="hidden" id="preciocebolla" value="0.5"/>
0,50</td>
<td><input type="text" size="8" id="totalcebolla" value="0" />
&euro;</td>
</tr>
<tr>
<td>Total</td>
<td></td><td></td>
<td> <input type="text" id="total" size="8" value="0" />
€</td>
</tr>
</table>
<p>
<label>
<input type="submit" name="enviar" id="enviar" value="Enviar" />
</label>
</p>
</form>
</body>