Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/07/2008, 06:07
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años, 1 mes
Puntos: 772
Respuesta: habilitar/deshabilitar checkboxes segun eleccion en select

Hola PedroRodas

Un ejemplo rápido:

Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <html>
<
head>
<
script type="text/javascript">
function 
habilitar(valor) {
  
frm document.forms[0];
  for (
i=0ele frm.elements[i]; i++)
    if (
ele.type == 'checkbox'
      
ele.disabled = (ele.className != valor);
}
</script>
</head>
<body>
<form>
<select onchange = "habilitar(this.value)">
<option value="coches">Coches</option>
<option value="aviones">Aviones</option>
</select>
<input type="checkbox" class="coches" disabled = "disabled" />
<input type="checkbox" class="aviones" disabled = "disabled" />
<input type="checkbox" class="coches" disabled = "disabled" />
</form>
</body>
</html> 
Saludos,