Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/07/2009, 00:46
Avatar de Breaklo
Breaklo
 
Fecha de Ingreso: junio-2008
Ubicación: Buenos Aires
Mensajes: 95
Antigüedad: 15 años, 10 meses
Puntos: 1
Checkbox [PROBLEMA]

yo tengo lo siguiente..

Código html:
Ver original
  1. <form onsubmit="return Submit(this)" name="formulario>
  2. <input type="checkbox" name="c1"/>
  3. <input type="checkbox" name="c1" />
  4. <input type="checkbox" name="c1" />        
  5. <input type="submit" />    
  6. </form>

Código javascript:
Ver original
  1. function Submit(form){
  2.     for(i=0;i<form.elements.length-1;i++){
  3.         var este = form.elements[i];
  4.         var tipo = este.type;
  5.         if(tipo == "checkbox")
  6.                alert(form.este.name.length);//cantidad de checkbox que hay (no anda :C)
  7.  
  8.                      
  9.     }
  10. }


lo mas facil seria hacer alert(document.formulario.c1.length), pero es dinamico la function, asique no puedo especificar nombres..

Última edición por Breaklo; 29/07/2009 a las 00:57