Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/01/2016, 09:36
__SDP__
 
Fecha de Ingreso: agosto-2010
Ubicación: santiago, CHILE
Mensajes: 564
Antigüedad: 13 años, 8 meses
Puntos: 9
Respuesta: verificar Checkbox esta sin marcar con if

la validacion de javascript la saque por ahi, y me toco lo facil

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2.  
  3.     function test(){
  4.        
  5.         formulario = document.getElementById("formulario");
  6.         for(var i=0; i<formulario.elements.length; i++) {
  7.           var elemento = formulario.elements[i];
  8.           if(elemento.type == "checkbox") {
  9.             if(!elemento.checked) {
  10.               //return false;
  11.             }else{
  12.                 alert(elemento.value);             
  13.             }
  14.           }
  15.         }      
  16.     }
  17.    
  18. </head>
  19. <form id="formulario" action="" method="post" onsubmit="test(); return false;">
  20.  
  21.     <input type="checkbox" name="chktest" value="check 1">
  22.     <input type="checkbox" name="chktest" value="check 2">
  23.    
  24.     <input type="submit" value="enviar">
  25.    
  26. </form>
  27. </body>
  28. </html>