Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/04/2011, 04:27
Avatar de WizardDani
WizardDani
 
Fecha de Ingreso: noviembre-2008
Mensajes: 25
Antigüedad: 15 años, 5 meses
Puntos: 0
¿Suma automáticamente de valores de un formulario?

¡Hola!

A ver. Estoy haciendo un test de personalidad, por lo que cada respuesta tiene un propio "value". Me gustaría que, al final del formulario, hubiese un botón o algo del estilo que al tocar te dijera la suma total de los valores... No tengo la más remota idea de como hacerlo, si queréis ver el tipo de formulario al que me refiero este es el código:

Código:
<html>
<body>
<h3>¿Cuál es tu personalidad?</h3>
<form action="http://www.quizbox.com/builder/result.aspx?max=30&q=10" method="post" target="foo" onsubmit="window.open('', 'foo', 'width=450,height=300,status=yes,resizable=yes,scr ollbars=yes')">
<ol>
<li>Type your question5 here.</li><br />
<input type="radio" name="ans5" value="2"/>choice1<br />
<input type="radio" name="ans5" value="1"/>choice2<br />
<input type="radio" name="ans5" value="3"/>choice3<br /><br />
<li>Type your question6 here.</li><br />
<input type="radio" name="ans6" value="1"/>choice1<br />
<input type="radio" name="ans6" value="2"/>choice2<br />
<input type="radio" name="ans6" value="3"/>choice3<br /><br />
<li>Type your question7 here.</li><br />
<input type="radio" name="ans7" value="2"/>choice1<br />
<input type="radio" name="ans7" value="1"/>choice2<br />
<input type="radio" name="ans7" value="3"/>choice3<br /><br />
<li>Type your question8 here.</li><br />
<input type="radio" name="ans8" value="3"/>choice1<br />
<input type="radio" name="ans8" value="2"/>choice2<br />
<input type="radio" name="ans8" value="1"/>choice3<br /><br />
<li>Type your question9 here.</li><br />
<input type="radio" name="ans9" value="1"/>choice1<br />
<input type="radio" name="ans9" value="3"/>choice2<br />
<input type="radio" name="ans9" value="2"/>choice3<br /><br />
<li>Type your question10 here.</li><br />
<input type="radio" name="ans10" value="2"/>choice1<br />
<input type="radio" name="ans10" value="1"/>choice2<br />
<input type="radio" name="ans10" value="3"/>choice3<br /><br />
</ol>
<p><input type="submit" value="Resultado" onclick="this.value='Espera porfavor...'" /></p>
</form>
</body>
</html>
Entonces al final habría un botón que si lo tocas te saldría un mensaje de alerta diciéndote los puntos que has obtenido... Por ejemplo "Has obtenido 30 puntos, tu personalidad es x".

He buscado en el FAQ pero no encuentro cómo hacerlo para valores múltiples a la vez...

¡Gracias por adelantado!