I have a simple form, named CalForm, with 8 checkboxes on it, named Day0 through Day7.
If any of the checkboxes change, I want to call a function that checks for a few states and makes changes based on those states:
1. If Day0 is now checked, Days 1-7 should become unchecked.
2. If one or more of Days 1-7 are checked, Day0 should become unchecked.
3. If no checkboxes are checked, Day0 should become checked.
Even though I spend time on it, I still totally suck at figuring out how to address stuff. Here's what I have now, but I know I'm not referring to the objects correctly:
which is called in the checkboxes as
So... what have I totally screwed up? 
Thanks in advance.
If any of the checkboxes change, I want to call a function that checks for a few states and makes changes based on those states:
1. If Day0 is now checked, Days 1-7 should become unchecked.
2. If one or more of Days 1-7 are checked, Day0 should become unchecked.
3. If no checkboxes are checked, Day0 should become checked.
Even though I spend time on it, I still totally suck at figuring out how to address stuff. Here's what I have now, but I know I'm not referring to the objects correctly:
Code:
function ManageDayBoxes() {
if(document.forms[CalForm].elements[Day0].checked){
document.forms[CalForm].elements[Day1].checked = false;
document.forms[CalForm].elements[Day2].checked = false;
document.forms[CalForm].elements[Day3].checked = false;
document.forms[CalForm].elements[Day4].checked = false;
document.forms[CalForm].elements[Day5].checked = false;
document.forms[CalForm].elements[Day6].checked = false;
document.forms[CalForm].elements[Day7].checked = false;
} else {
if document.forms[CalForm].elements[Day1].checked = false && document.forms[CalForm].elements[Day2].checked = false && document.forms[CalForm].elements[Day3].checked = false && document.forms[CalForm].elements[Day4].checked = false && document.forms[CalForm].elements[Day5].checked = false && document.forms[CalForm].elements[Day6].checked = false && document.forms[CalForm].elements[Day7].checked = false {
document.forms[CalForm].elements[Day0].checked = true;
} else {
document.forms[CalForm].elements[Day0].checked = false;
}
}
}
Code:
onchange='ManageDayBoxes()'

Thanks in advance.