当第一个单选按钮被选中时,我需要所有三个复选框来检查和禁用。
When the second or third radio button other_1
is selected, I need the three checkboxes to uncheck and enable again.
代码(无效):
function validate_Days() {
var noOfDays = 0;
if (document.classic.r.value = "3daypass") {
noOfDays = 3;
}
if (document.classic.r.value = "2daypass") {
noOfDays = 2;
}
if (document.classic.r.value = "1daypass") {
noOfDays = 1;
}
if (noOfDays == 3) {
document.getElementById('cb1').checked = true;
document.getElementById('cb2').checked = true;
document.getElementById('cb3').checked = true;
}
else if (noOfDays == 2) {
document.getElementById('cb1').checked = false;
document.getElementById('cb2').checked = false;
document.getElementById('cb3').checked = false;
}
else if (noOfDays == 1) {
document.getElementById('cb1').checked = false;
document.getElementById('cb2').checked = false;
document.getElementById('cb3').checked = false;
}
}
编辑:删除禁用并使用更有用的名称/值