Ver Mensaje Individual
  #10 (permalink)  
Antiguo 21/03/2013, 16:10
Avatar de miguec04
miguec04
 
Fecha de Ingreso: agosto-2008
Ubicación: Cimitarra, Santander
Mensajes: 378
Antigüedad: 15 años, 8 meses
Puntos: 15
Respuesta: pasar un checkbox a checked y luego a no checked con javascript

espero te sirva.

Código HTML:
Ver original
  1.     .COLOR_AZUL {
  2.         color: #3366cc;
  3.     }
  4.    
  5.     .COLOR_NORMAL {
  6.         color: #000;   
  7.     }
  8.  
  9. <input id="caja14" type="checkbox" onclick="ajax1(this);"/>
  10. <input id="boton14"  value="boton" type="button" class="COLOR_NORMAL" onclick="ajax1(null);"/>
  11. Código Javascript:
  12. Ver original
  13. <script type="text/javascript">
  14. function ajax1(elem){
  15.    
  16.     var elemento                                    = document.getElementById('caja14');
  17.     var colorboton                                  = document.getElementById('boton14');
  18.     if(elem==null) {
  19.         elemento.checked                                = !elemento.checked;
  20.     }
  21.    
  22.     if(!elemento.checked) {
  23.         colorboton.setAttribute('class','COLOR_NORMAL');
  24.     } else {
  25.         colorboton.setAttribute('class','COLOR_AZUL');
  26.     }
  27. }
__________________
Desoftc Technology - Miguel Carmona
Creaciones Inteligentes - Cimitarra Colombia
[email protected]
http://www.desoftc.com.co