Jump to content

Select Checkboxes with an array as name


jh_dempsey

Recommended Posts

Hey All

 

On my webpage i have 3 groups of checkboxes, all of which have names that are arrays

eg uni_id[$i] , open_entrants[$j] and other_entrants[$k

($i , $j and $k will be numbers)

 

What i need is 3 seperate Check All / Uncheck All buttons, one for each group of checkboxes.

 

Ive managed to find the following code that checks every single box on my page. How do i make it so that it only checks the name of the checkbox group that i pass to it??

 

<SCRIPT LANGUAGE="JavaScript">
<!--
function checkall()
{
var df=document.form1.elements;
for(var i=0;i<df.length;i++)
{ 
//alert(df[i].name);
df[i].checked=true;
}
}

function uncheckall()
{
var df=document.form1.elements;
for(var i=0;i<df.length;i++)
{ 
//alert(df[i].name);
df[i].checked=false;
}
}
-->
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.