我想在选择下拉列表的一个固定值时显示复选框列表:javascript:
function getDays(){
var selectedString = select.options[select.selectedIndex].value;
if(selectedString == 4)
{
document.getElementById("days_target").style.display = "block";
}
}
html:
<b>Please enter days required</b><br/>
<select name="days" id="days" style="width:200px;" onchange="getDays()">
<option value="0">Select</option>
<option value="1">Mon-Fri</option>
<option value="2">Mon-Fri</option>
<option value="3">Mon-Fri</option>
<option value="4">Bespoke Days</option>
</select><br/><br/>
<div id="days_target" style="display:none;">
<input type="checkbox" name="day" value="mon">Mon <input type="checkbox" name="day" value="tue">Tue<br/>
<input type="checkbox" name="day" value="wed">Wed <input type="checkbox" name="day" value="thr">Thr<br/>
<input type="checkbox" name="day" value="fri">Fri <input type="checkbox" name="day" value="sat">Sat<br/>
<input type="checkbox" name="day" value="sun">Sun<br/><br/>
</div>
但它不起作用。我做错了什么?