js 通过单选框 展开和收缩 下拉框
input控件 <%--选择是否入住单选框,动态显示宿舍下拉框--%> <div id="c"> <input type ="radio" id="r1" name ="g" onclick ="cc1()" />是 <input type ="radio" id="r2" name ="g" />否<br /> <select size ="5" style ="display :none " id ="s1"> <option >请选择</option> <option >男生寝室</option> <option >女生寝室</option> </select> </div> js代码 function cc1() { var q4 = document.getElementById("r1"); var q5 = document.getElementById("r2"); var q6 = document.getElementById("s1"); if (q4.checked == true) { q6.style.display = "block"; } else { q6.style .display ="none"; } }