Hello, hoping an javascript guru can can help.. I have this function to check and uncheck a large number of checkboxes.. function CheckAll(form){ for(var i=0;i<form.elements.length;i++){ var e = form.elements[i]; if (e.name == 'checkme[]'){ e.checked = form.chkall.checked; } } } PHP: the form... print "<form...>"; print "<input name='chkall' type='checkbox' onclick='CheckAll(this.form);'> Select All"; $i=0; loop... print "<input type='checkbox' name='checkme[$i]' value='on' />"; end loop... print "</form>"; PHP: The javascript function looks to find all occurrences of the checkbox name 'checkme[]' but the problem is the form checkbox name is dynamic 'checkme[$i]' My question is how can I adjust this line to match the dynamic checkbox name 'checkme[$i]' if (e.name == 'checkme[]') PHP:
Yes you correct $i is a digit, hehehe that worked a treat. Thanks One day i will fully understand JavaScript.