Ver Mensaje Individual
  #4 (permalink)  
Antiguo 06/07/2011, 12:46
alexg88
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años, 10 meses
Puntos: 344
Respuesta: Problemas con validación de checkbox

Lo mejor es utilizar el atributo name:

Código PHP:
Ver original
  1. echo('<input type="checkbox" name="oferta[]" value="C'.$contador.'" />');

Código Javascript:
Ver original
  1. function valida()
  2. {
  3.  
  4.     inputs = document.getElementsByName("oferta[]");
  5.    
  6.     for (i=0; i<inputs.length; i++)
  7.     {
  8.    
  9.         if (inputs[i].checked)
  10.         {
  11.        
  12.             //return conf();
  13.             return true;
  14.            
  15.        
  16.         }
  17.    
  18.     }
  19.    
  20.     alert("¡No has seleccionado ninguna oferta!");
  21.     return false;
  22. }