perhaps this might be useful:
<script type="text/javascript">
var MonthDays=Array("","31", "28", "31", "30", "31", "30", "31", "31", "30",
"31", "30", "31");
function MonthToggle(FormObject,CBMonth)
{
var daycount="01";
for(n=1;n<=MonthDays[parseInt(CBMonth,10)];n++)
{
if(n<10)
daycount='0'+n;
else
daycount=n;
var CBObject=FormObject.elements['m'+CBMonth+daycount];
// this toggles the state of each checkbox, depending on the current state
// if you want to just set or unset all the checkboxes the code will be
simpler
// use CBObject.checked=true/false; instead of the switch statements.
switch(CBObject.checked)
{
case true:
CBObject.checked=false;
break;
case false:
CBObject.checked=true;
break;
}
}
}
</script>
assuming the form is layed out in the following manner:
<form name="yearform">
<input type="checkbox" name="m0101" value="0101">1
<input type="checkbox" name="m0102" value="0102">2
<input type="checkbox" name="m0103" value="0103">3
<input type="checkbox" name="m0104" value="0104">4
.....
<input type="checkbox" name="m0131" value="0131">31
<a href="#" onClick="MonthToggle(document.forms['yearform'],'01'); return
false;">January</a>
<input type="checkbox" name="m0201" value="0201">1
<input type="checkbox" name="m0202" value="0202">2
<input type="checkbox" name="m0203" value="0203">3
<input type="checkbox" name="m0204" value="0204">4
.....
<input type="checkbox" name="m0228" value="0228">28
<a href="#" onClick="MonthToggle(document.forms['yearform'],'02'); return
false;">JFebruary</a>
......
<input type="checkbox" name="m1201" value="1201">1
<input type="checkbox" name="m1202" value="1202">2
<input type="checkbox" name="m1203" value="1203">3
<input type="checkbox" name="m1204" value="1204">4
.....
<input type="checkbox" name="m1231" value="1231">31
<a href="#" onClick="MonthToggle(document.forms['yearform'],'12'); return
false;">December</a>
</form>
tested in IE6, NetScape 7 and Opera 7.01
"John Banta" <si**********@yahoo.com> wrote in message
news:31**************************@posting.google.c om...
Hi,
I have created a 12 month calendar where each day has a check box
whereby the user can indicate if that day is available or not
available for a certain event. The calendar is 'drawn' in a single
form rather than 12 separate forms.
If the checkbox contained in each day within each month has a unique
name such as 1August2003, 2August2003, etc, is there a way in
Javascript where I could have a button by each month where the user
could click once to check each box within that month but not the other
11 months? For example, I would like to have a link next to the
January header where the user can select all days in January.
I have seen posts where you can sleect all boxes within the form but
that isn't exactly what I need...I need to somehow do that but only if
the name contains a certain string (the month name in this case). Any
help would be much appreciated.
-John