オプション要素があり、ラジオ ボタンに基づいて値を変更しようとしています。簡単な方法でオプション要素をクリア/追加することができなかったので、内部の html だけを変更したいと思います。 Firefox ではありますが、IE ではありません。
私の選択オプション
<select name="TOR" id="TOR">
<option value="MVR Only">MVR Only</option>
<option value="Employee">Employee</option>
<option value="Employee + MVR">Employee + MVR</option>
<option value="Faculty">Faculty</option>
<option value="Faculty + MVR">Faculty + MVR</option>
<option value="Students">Students</option>
<option value="Students + MVR">Students + MVR</option>
<option value="Volunteers">Volunteers</option>
<option value="Volunteers + MVR">Volunteers + MVR</option>
<option value="International Employee">International Employee</option>
<option value="International Employee + MVR">International Employee + MVR</option>
<option value="International Faculty">International Faculty</option>
<option value="International Faculty + MVR">International Faculty + MVR)</option>
<option value="International Students">International Students)</option>
<option value="International Students + MVR">International Students + MVR)</option>
<option value="International Volunteers">International Volunteers)</option>
<option value="International Volunteers + MVR">International Volunteers + MVR)</option>
</select>
オプションを変更する JavaScript
<script>
function RadioChange(){
var x = document.getElementById("TOR");
x.innerHTML = " ";
if(document.getElementsByName("FTE")[0].checked == true){
x.innerHTML +='<option value="MVR Only(FTE)">MVR Only(FTE)</option>';
x.innerHTML +='<option value="Employee(FTE)">Employee(FTE)</option>';
x.innerHTML +='<option value="Employee + MVR(FTE)">Employee + MVR(FTE)</option>';
x.innerHTML +='<option value="Faculty(FTE)">Faculty(FTE)</option>';
x.innerHTML +='<option value="Faculty + MVR(FTE)">Faculty + MVR(FTE)</option>';
x.innerHTML +='<option value="International Employee(FTE)">International Employee(FTE)</option>';
x.innerHTML +='<option value="International Employee + MVR(FTE)">International Employee + MVR(FTE)</option>';
x.innerHTML +='<option value="International Faculty(FTE)">International Faculty(FTE)</option>';
x.innerHTML +='<option value="International Faculty + MVR(FTE)">International Faculty + MVR(FTE)</option>';
}
if(document.getElementsByName("FTE")[1].checked==true){
x.innerHTML +='<option value="MVR Only">MVR Only</option>';
x.innerHTML +='<option value="Employee">Employee</option>';
x.innerHTML +='<option value="Employee + MVR">Employee + MVR</option>';
x.innerHTML +='<option value="Faculty">Faculty</option>';
x.innerHTML +='<option value="Faculty + MVR">Faculty + MVR</option>';
x.innerHTML +='<option value="Students">Students</option>';
x.innerHTML +='<option value="Students + MVR">Students + MVR</option>';
x.innerHTML +='<option value="Volunteers">Volunteers</option>';
x.innerHTML +='<option value="Volunteers + MVR">Volunteers + MVR</option>';
x.innerHTML +='<option value="International Employee">International Employee</option>';
x.innerHTML +='<option value="International Employee + MVR">International Employee + MVR</option>';
x.innerHTML +='<option value="International Faculty">International Faculty</option>';
x.innerHTML +='<option value="International Faculty + MVR">International Faculty + MVR)</option>';
x.innerHTML +='<option value="International Students">International Students)</option>';
x.innerHTML +='<option value="International Students + MVR">International Students + MVR)</option>';
x.innerHTML +='<option value="International Volunteers">International Volunteers)</option>';
x.innerHTML +='<option value="International Volunteers + MVR">International Volunteers + MVR)</option>';
}
}
</script>