jh_dempsey Posted May 21, 2007 Share Posted May 21, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.