I have a form that has a calendar for users to click on certain days. I would like to offer a button for them select all the days, but i’m having trouble. Ways that I’ve found for making a “check all” button aren’t working because I named my check boxes with a “” at the end because I need them to be an array for the php processing on the submit page.
Here is the javascript code I’m trying to use:
function check_all()
{
var z=0;
var box;
for (z=0; z<54; z++)
{
document.getElementById('day'+z).checked = true;
}
}
and here is the html code:
<input type="button" name="Check_All" value="Select All Days" onClick="check_all()">
<input type="button" id="clearAll" value="Clear All Days" onClick="un_check_all();"><br /><br />
<table >
<tr>
<td><input type="checkbox" name="Day[]" id="day0"></td>
<td><input type="checkbox" name="Day[]" id="day1"></td>
<td><input type="checkbox" name="Day[]" id="day2"></td>
<td><input type="checkbox" name="Day[]" id="day3"></td>
<td><input type="checkbox" name="Day[]" id="day4"></td>
</tr>
</table>