|
Q1447 How could I change whether a check box or radio button is checked depending on what the user select from a drop down list?
irt.org | Knowledge Base | JavaScript | Form | Q1447 [ previous next ]
Q1447 How could I change whether a check box or radio button is checked depending on what the user select from a drop down list?
Try:
<script language="JavaScript"><!--
function changed(form) {
if (form.theSelect.options[form.theSelect.selectedIndex].value == 'yes') {
form.theRadio.checked=true;
form.theCheckbox.checked=true;
}
else {
form.theRadio.checked=false;
form.theCheckbox.checked=false;
}
}
//--></script>
<form>
<select onChange="changed(this.form)" name="theSelect">
<option value="no">no
<option value="yes">yes
</select>
<input type="radio" name="theRadio">
<input type="checkbox" name="theCheckbox">
</form
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.