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
https://forums.phpfreaks.com/topic/52279-select-checkboxes-with-an-array-as-name/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.