I am working on a page that has 4 different arrays of checkboxes - I would like to create a function that will
loop thru the array of chkboxes to determine which one the user selected and return the name of the chkbox and the number.
The first part of my code is below - please assist -I am a new programmer and this is my first assignment.
function BoxChecked(chkBox){
var aName;
var sName;
var i;
var aEval;
var obj;
aName=chkBox.name.split("_"
sName=aName[0];
if (aName[0]=="chkCircType"{
//If the "All" box is checked and the user clicked a box other than "All"
//"chkCircType_1" represents the "all" checkbox
if((ccform.item("chkCircType_1".checked) && (chkBox.name != "chkCircType_1")
{//then turn off the "All" box and...
ccform.item("chkCircType_1".checked=false;
// turn off all boxes except the box the user checked.
for(i=0; i<ccform.hCircTypeCount.value; i++)
{
if ((i+1) != aName[1]){
ccform.item("chkCircType_"+(i+1)).checked=false;}
else {
ccform.item("chkCircType_"+(i+1)).checked=true;}
}}
else {
if(ccform.item("chkCircType_1".checked) {
for(i=0; i<ccform.hCircTypeCount.value; i++){
ccform.item("chkCircType_"+(i+1)).checked=true; }
}}}
Thanks for your help.
loop thru the array of chkboxes to determine which one the user selected and return the name of the chkbox and the number.
The first part of my code is below - please assist -I am a new programmer and this is my first assignment.
function BoxChecked(chkBox){
var aName;
var sName;
var i;
var aEval;
var obj;
aName=chkBox.name.split("_"
sName=aName[0];
if (aName[0]=="chkCircType"{
//If the "All" box is checked and the user clicked a box other than "All"
//"chkCircType_1" represents the "all" checkbox
if((ccform.item("chkCircType_1".checked) && (chkBox.name != "chkCircType_1")
{//then turn off the "All" box and...
ccform.item("chkCircType_1".checked=false;
// turn off all boxes except the box the user checked.
for(i=0; i<ccform.hCircTypeCount.value; i++)
{
if ((i+1) != aName[1]){
ccform.item("chkCircType_"+(i+1)).checked=false;}
else {
ccform.item("chkCircType_"+(i+1)).checked=true;}
}}
else {
if(ccform.item("chkCircType_1".checked) {
for(i=0; i<ccform.hCircTypeCount.value; i++){
ccform.item("chkCircType_"+(i+1)).checked=true; }
}}}
Thanks for your help.