Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I have a drop down menu with the 12 months. Below that is a list of names with a checkbox next to each. I want to be able to select the month and have the checkboxes populated with info from a MS Access database. The database has months as a primary key and all the names with true/false values for each.
Any ideas on how to do this with either ASP or Javascript?
Thanks.DMR

Would help if you supplied more details. For instance are you buildng the checkboxes dynamiccaly throug the database? What are the values of the checkboxes? What is your level of expertise?
But, here is a general description of how it can be done.
In a javascript block create a nested array. Each sub array will be for each month of the year (0=January, 1=February, etc.) In each sub array enter the values of the checkboxes corresponding to each of the names for that month. Example:
---------------------
dateAry = new Array ();
dateAry[0] = new Array ('Mike','David');
dateAry[1] = new Array ('Ana','John');
dateAry[2] = new Array ('Chris','Joe');
dateAry[3] = new Array ('Ralph','JoJo');
Etc . . . down to 11 for Dec.
---------------------Then also create a javascript function that will run onChange of the select list. Assuming that the select list is named month, here is what the function could look like:
----------------------
function changeMonth() {
var df = document.forms[0];
selMon = df.month.value;
for (i=0; i<12; i++){
if (i==selMonth) {chkVal = true}
else {chkVal = false}
for (j=0; j<dateAry[i].length; j++) {
df[dateAry[i][j]].checked = chkVal;
}
}
----------------------Michael J

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |