0
當選擇第一個單選按鈕時,我需要檢查和禁用所有三個複選框。在單選按鈕檢查上啓用/禁用選擇框
當選中第二個或第三個單選按鈕other_1
時,我需要三個複選框取消選中並再次啓用。
CODE(非工作):
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;
}
}
編輯:刪除禁用和使用更多的有用的名稱/值