Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/09/2009, 11:11
monxas
 
Fecha de Ingreso: mayo-2009
Mensajes: 201
Antigüedad: 15 años
Puntos: 9
Respuesta: ver si al menos un checkbox esta tildado

a ver, te contesto rapido que seguro que estas deseando una respuesta:
mi solucion seguro que se puede hacer con un for, pero eso ya lo miras tu, te contesto rapido que tengo prisa.
(esta en pseudocodigo eh?)


funcion comprobarcheckboxes(){
var ch1 = document.etElementById('ch1').value; (no recuerdo si se miraba con value pero si no investigas)
var estaActivo=0

var ch2 = document.etElementById('ch2').value;
var ch3 = document.etElementById('ch3').value;
var ch4 = document.etElementById('ch4').value;
var ch5 = document.etElementById('ch5').value;
var ch6 = document.etElementById('ch6').value;
....
y luego:
if (ch1=true){
estaActivo= estaActivo + 1
}
if (ch2=true){
estaActivo= estaActivo + 1
}
if (ch3=true){
estaActivo= estaActivo + 1
}
if (ch4=true){
estaActivo= estaActivo + 1
}
.........

y asi con todos, y por ultimo :
if (estaActivo>0){
alert('hay al menos un checkbox activo')
}
}