bluntburn: Radiobuttons durch checkbox enablen

Beitrag lesen

Hi Michi,

so geht's...

<script>
function switchRadios() {
 if(document.myForm.myCheckbox.checked==true) {
  for(i=0;i<document.myForm.myRadio.length;i++) document.myForm.myRadio[i].disabled=false;
 }
 else {
  for(i=0;i<document.myForm.myRadio.length;i++) document.myForm.myRadio[i].disabled=true;
 }
}
</script>
<form name="myForm">
<input type="checkbox" name="myCheckbox" onClick="switchRadios();"> 1, 2 oder 3 ? :)
<br><br>
<input type="radio" name="myRadio" value="1" disabled="disabled"> 1<br>
<input type="radio" name="myRadio" value="2" disabled="disabled"> 2<br>
<input type="radio" name="myRadio" value="3" disabled="disabled"> 3<br>
</form>