Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/12/2012, 17:35
djleonilo
 
Fecha de Ingreso: julio-2011
Mensajes: 88
Antigüedad: 13 años, 7 meses
Puntos: 2
Respuesta: Error NAN en este script

Listo amigos ya lo solucione, la verdad es tener algo de pasiencia y analizar lo que quieres hacer. Les comparto el codigo final por si alguien lo necesita.

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es">
  3.     <head>
  4.         <title></title>
  5.         <script language="javascript" type="text/javascript">
  6.         function suma(obj)
  7.         {
  8.             total = document.getElementById("numero").innerHTML;
  9.             if(obj.checked){
  10.                 total++;
  11.             }else{
  12.                 total--;
  13.             }
  14.             document.getElementById("numero").innerHTML=total;
  15.         }
  16.        
  17.         </script>
  18.     </head>
  19.     <body>
  20.     <input type="checkbox" name="chck1" onChange="suma(this)">
  21.     <input type="checkbox" name="chck2" onChange="suma(this)">
  22.     <input type="checkbox" name="chck3" onChange="suma(this)">
  23.     <hr>
  24.     <h1 id="numero">0</h1>
  25.    
  26.     </body>
  27. </html>