Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/11/2012, 23:09
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: ¿Manejo de radiobutton y un textbox?

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"
  2. "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
  5. <title>suma</title>
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. function sumar(){
  9. var total=0;
  10. for (i=0;i<document.formulario.elements.length;i++){
  11. if(document.formulario.elements[i].checked){
  12. total+=parseInt(document.formulario.elements[i].value);
  13. }
  14. }
  15. document.getElementById('total').innerHTML =total;
  16. }
  17. //]]>
  18. </head>
  19. <div>
  20. <form name="formulario" action="#">
  21. 1 <input type="checkbox" name="x" value="1" onclick="sumar()" />
  22. 2 <input type="checkbox" name="x" value="2" onclick="sumar()" />
  23. 3 <input type="checkbox" name="x" value="3" onclick="sumar()" />
  24. </form>
  25. <div id="total"></div>
  26. </div>
  27. </body>
  28. </html>

Ahora solo te resta hacerlo con radiobuttons

Salu2
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.