Heya,
I've done this before by having a hidden form field named something
like 'checkboxesStartHere', then looping through the form elements by
number. When you find that hidden field you know the next element will
be your first checkbox.
Would this work for your project?
Wednesday, April 14, 2004, 1:31:42 AM, you wrote:
bb> hi all
bb> I've got a form with a hundred or so checkboxes. I want to set up small
bb> groups of them to check/uncheck. I can't use the name (form processing,
bb> diff order) so I'm trying to use the ID.
bb> the bit I'm stuck on is getting an array of checkboxes and then looping
bb> thru them to check only using the ID. I can get the first one to work but
bb> not the other ones of the same name. any ideas?
bb> thanx
bb> barry.b
bb> <script>
bb> function checkAll(id) {
bb> cbox = eval("document.getElementById(id)");
bb> if (cbox.checked == true){
bb> cbox.checked = false;
bb> return "Check All";
bb> }else{
bb> cbox.checked = true;
bb> return "Uncheck All";
bb> }
bb> }
bb> </script>
bb> here's part of the form
bb> <td><input type=button value="Check All"
onClick="this.value=checkAll('view_ADM')"></td>
bb> <td><input type=button value="Check All"
onClick="this.value=checkAll('add_ADM')"></td>
bb> <td><input type=button value="Check All"
onClick="this.value=checkAll('edit_ADM')"></td>
bb> <td><input type=button value="Check All"
onClick="this.value=checkAll('del_ADM')"></td>
bb> </tr>
bb> <tr>
bb> <td> Menu Admin </td>
bb> <td><input type="Checkbox" name="Perm_b_40 " id="view_ADM" checked></td>
bb> <td><input type="Checkbox" name="Perm_b_37 " id="add_ADM"></td>
bb> <td><input type="Checkbox" name="Perm_b_39 " id="edit_ADM"></td>
bb> <td><input type="Checkbox" name="Perm_b_38 " id="del_ADM"></td>
bb> </tr>
bb> <tr>
bb> <td> Users Admin </td>
bb> <td><input type="Checkbox" name="Perm_b_36 " id="view_ADM" checked></td>
bb> <td><input type="Checkbox" name="Perm_b_33 " id="add_ADM"></td><td><input
type="Checkbox" name="Perm_b_35 "id="edit_ADM"></td>
bb> <td><input type="Checkbox" name="Perm_b_34 " id="del_ADM"></td>
bb> </tr>
bb> <tr>
bb> <td> Utilities Admin </td>
bb> <td><input type="Checkbox" name="Perm_b_44 " id="view_ADM" checked></td>
bb> <td><input type="Checkbox" name="Perm_b_41 " id="add_ADM"></td>
bb> <td><input type="Checkbox" name="Perm_b_43 " id="edit_ADM"></td>
bb> </tr>
bb> ---
bb> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
bb> To unsubscribe send a blank email to [EMAIL PROTECTED]
bb> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
bb> http://www.mxdu.com/ + 24-25 February, 2004
-----------------------
Ryan Sabir
Newgency Pty Ltd
2a Broughton St
Paddington 2021
Sydney, Australia
Ph (02) 9331 2133
Fax (02) 9331 5199
Mobile: 0411 512 454
http://www.newgency.com/index.cfm?referer=rysig
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004