关于一个单选按钮控制下拉框的问题!
<script>
function aaa(){
for(var i=0;i <document.getElementsByName( "rr ").length;i++){
if(document.getElementsByName( "rr ")[i].checked)
ss.options[i].selected= "true ";
}
}
</script>
A: <input type=radio name=rr onClick= "aaa() ">
B: <input type=radio name=rr onClick= "aaa() ">
C: <input type=radio name=rr onClick= "aaa() ">
<br>
<select id=ss>
<option> AAAAAA </option>
<option> BBBBBB </option>
<option> CCCCCC </option>
</select>
=====================
代码放入 <form> 代码 </form> 中报错报 "ss "未定义,麻烦各位达人给予解答,万分感谢!
------解决方案--------------------document.getElementById( "ss ").options[i].selected=true;