Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/07/2011, 04:09
elburdel
 
Fecha de Ingreso: julio-2005
Mensajes: 204
Antigüedad: 18 años, 9 meses
Puntos: 1
Respuesta: desactivar varios campos checked

Yo lo haría así

Código PHP:
<input type="checkbox" id"algo" />Seleccionar
<input type="radio" name="algo1" value="Boca" disabled="disabled" />Boca
<input type="radio" name="algo1" value="River" disabled="disabled" />River 
[PHP]

var checkbox = document.getElementById("algo");
checkbox.onclick = activar;
function activar()
{
var radioButtons = document.getElementsByName("algo1");

var checkbox = document.getElementById("algo");

// Si el checkbox esta tildado se activan los radio y viceversa
if (checkbox.checked)
{ for (var i = 0; i < radioButtons.length; i++)
{
radioButtons[i].disabled = false;
};
}
else {
for (var i = 0; i < radioButtons.length; i++)
{
if(radioButtons[i].type=="radio")
radioButtons[i].disabled = true;
};
}
}