Pregunta: | 68259 - RESPUESTA FORMULARIO |
Autor: | emeteria96 Suarez |
Hola amigos mi nombre es Emeteria necesito vuestra ayuda, ya que soy principianta en estos temas, gracias a todos de antemano, nos vemos un saludo. Necesito Ayuda con formulario, quiero recibirlo tipo factura, más o menos, como en la muestra. <html> <head> <title>Mi pagina web</title> <script> function calculo(cantidad,precio,inputtext,totaltext){ /* 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(totaltext.value); totaltext.value = total + subtotal; } </script> <style type="text/css"> .negrita { font-weight: bold; } </style> <style type="text/css"> </style> <body> <h1>ELIGE TUS PRODUCTOS</h1> <form action="mailto:[email protected]" method="post" enctype="text/plain"> <table width="500"> <tr> <td width="197" bgcolor="#D4FFAA"><div align="center"><strong>Productos</strong></div></td> <td width="72" align="left" bgcolor="#D4FFAA" class="negrita">Cantidad</td> <td width="66" bgcolor="#D4FFAA" class="negrita">Precio/Ud</td> <td width="109" bgcolor="#D4FFAA" class="negrita">Total</td> </tr> <tr> <td bgcolor="#D4FFAA"><strong>Camiseta</strong></td> <td align="left" bgcolor="#D4FFAA"><input type="text" size="2" id="Camiseta" value="0" onChange="calculo(this.value,precioCamiseta.value, totalCamiseta,total);"> uds</td> <td bgcolor="#D4FFAA"><input type="hidden" id="precioCamiseta" value="42"/> 42 €</td> <td bgcolor="#D4FFAA"><input type="text" size="8" id="totalCamiseta" value="0"> €</td> </tr> <tr> <td bgcolor="#D4FFAA"><strong>Sudadera</strong></td> <td align="left" bgcolor="#D4FFAA"><input type="text" size="2" id="Sudadera" value="0" onChange="calculo(this.value,precioSudadera.value, totalSudadera,total);"> uds</td> <td bgcolor="#D4FFAA"><input type="hidden" id="precioSudadera" value="35"/> 35 €</td> <td bgcolor="#D4FFAA"><input type="text" size="8" id="totalSudadera" value="0"> €</td> </tr> <tr> <td bgcolor="#D4FFAA"><strong>Pantalon</strong></td> <td align="left" bgcolor="#D4FFAA"><input type="text" size="2" id="Pantalon" value="0" onChange="calculo(this.value,precioPantalon.value, totalPantalon,total);"> uds</td> <td bgcolor="#D4FFAA"><input type="hidden" id="precioPantalon" value="23"/> 23 €</td> <td bgcolor="#D4FFAA"><input type="text" size="8" id="totalPantalon" value="0"> €</td> </tr> <tr> <td bgcolor="#D4FFAA"><strong>Calzado</strong></td> <td align="left" bgcolor="#D4FFAA"><input type="text" size="2" id="Calzado" value="0" onChange="calculo(this.value,precioCalzado.value,t otalCalzado,total);"> uds</td> <td bgcolor="#D4FFAA"><input type="hidden" id="precioCalzado" value="27"/> 27 €</td> <td bgcolor="#D4FFAA"><input type="text" size="8" id="totalCalzado" value="0"> €</td> </tr> <tr> <td bgcolor="#D4FFAA"><strong>Calcetines</strong></td> <td align="left" bgcolor="#D4FFAA"><input type="text" size="2" id="Calcetines" value="0" onChange="calculo(this.value,precioCalcetines.valu e,totalCalcetines,total);"> uds</td> <td bgcolor="#D4FFAA"><input type="hidden" id="precioCalcetines" value="12"/> 12 €</td> <td bgcolor="#D4FFAA"><input type="text" size="8" id="totalCalcetines" value="0"> €</td> </tr> <td height="81" bgcolor="#D4FFAA"><strong>Total:</strong></td> <td align="left" bgcolor="#D4FFAA"></td> <td bgcolor="#D4FFAA"></td> <td bgcolor="#D4FFAA"><p><br/> <input type="text" id="total"size="10" value="0"> €</p> <p>*</p></td> </tr> </table> <input name="Enviar" type="submit" id="Enviar" value="Enviar información"> <input name="Borrar" type="reset" id="Borrar" value="Borrar información"> </form> </body> </html> ------------------------------------------------------------ Productos Cantidad P/ud Total Camiseta 1 42-€ 42 Sudadera 3 34-€ 105 Pantalon 2 23-€ 46 calzado 1 27-€ 27 Calcetines 5 12-€ 60 TOTAL 280 € |