使用JavaScript
显示无和使用html下拉列表进行阻止function getval(sel) {
if (document.getElementById("applicant").value = "2") {
document.getElementById('li2').style.display = 'block';
document.getElementById('li3').style.display = 'none';
document.getElementById('li4').style.display = 'none';
document.getElementById('li5').style.display = 'none';
}
else if (document.getElementById("applicant").value = "3") {
document.getElementById('li2').style.display = 'block';
document.getElementById('li3').style.display = 'block';
document.getElementById('li4').style.display = 'none';
document.getElementById('li5').style.display = 'none';
}
else if (document.getElementById("applicant").value = "4") {
document.getElementById('li2').style.display = 'block';
document.getElementById('li3').style.display = 'block';
document.getElementById('li4').style.display = 'block';
document.getElementById('li5').style.display = 'none';
}
else if (document.getElementById("applicant").value = "5") {
document.getElementById('li2').style.display = 'block';
document.getElementById('li3').style.display = 'block';
document.getElementById('li4').style.display = 'block';
document.getElementById('li5').style.display = 'block';
}
}
答案 0 :(得分:1)
在不知道问题是什么的情况下(因为你不能描述它),我猜测它(你错过了=
)。
更改
if (document.getElementById("applicant").value = "..."
到
if (document.getElementById("applicant").value == "..."