>> If there is only one checkbox with the same name but I can't use name at all - that's the problem.
The names of the checkboxes are used for form processing and have nothing to do with the groups they need to be checked or unchecked. so that leaves using the ID only. The trouble is that getElementByID needs unique ID's to work - that's why only the first one in each series behaves correctly. The others just sit there. I'm starting to think it can't be done... thanx anyway barry.b -----Original Message----- From: Australia1976 [mailto:[EMAIL PROTECTED] Sent: Wednesday, 14 April 2004 8:53 AM To: CFAussie Mailing List Subject: [cfaussie] Re: (OT) access groups of chkboxes using ID, not name If there is only one checkbox with the same name, you can use cbox.checked If there is more than one, you use array notation: cbox[0].checked cbox[1].checked cbox[n].checked ----- Original Message ----- From: "barry.b" <[EMAIL PROTECTED]> To: "CFAussie Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, April 14, 2004 1:31 AM Subject: [cfaussie] (OT) access groups of chkboxes using ID, not name > hi all > I've got a form with a hundred or so checkboxes. I want to set up small > groups of them to check/uncheck. I can't use the name (form processing, > diff order) so I'm trying to use the ID. > > the bit I'm stuck on is getting an array of checkboxes and then looping > thru them to check only using the ID. I can get the first one to work but > not the other ones of the same name. any ideas? > > thanx > barry.b > > > <script> > function checkAll(id) { > cbox = eval("document.getElementById(id)"); > if (cbox.checked == true){ > cbox.checked = false; > return "Check All"; > }else{ > cbox.checked = true; > return "Uncheck All"; > } > } > </script> > > here's part of the form > > > <td><input type=button value="Check All" onClick="this.value=checkAll('view_ADM')"></td> > <td><input type=button value="Check All" onClick="this.value=checkAll('add_ADM')"></td> > <td><input type=button value="Check All" onClick="this.value=checkAll('edit_ADM')"></td> > <td><input type=button value="Check All" onClick="this.value=checkAll('del_ADM')"></td> > </tr> > <tr> > <td> Menu Admin </td> > <td><input type="Checkbox" name="Perm_b_40 " id="view_ADM" checked></td> > <td><input type="Checkbox" name="Perm_b_37 " id="add_ADM"></td> > <td><input type="Checkbox" name="Perm_b_39 " id="edit_ADM"></td> > <td><input type="Checkbox" name="Perm_b_38 " id="del_ADM"></td> > </tr> > <tr> > <td> Users Admin </td> > <td><input type="Checkbox" name="Perm_b_36 " id="view_ADM" checked></td> > <td><input type="Checkbox" name="Perm_b_33 " id="add_ADM"></td><td><input type="Checkbox" name="Perm_b_35 "id="edit_ADM"></td> > <td><input type="Checkbox" name="Perm_b_34 " id="del_ADM"></td> > </tr> > <tr> > <td> Utilities Admin </td> > <td><input type="Checkbox" name="Perm_b_44 " id="view_ADM" checked></td> > <td><input type="Checkbox" name="Perm_b_41 " id="add_ADM"></td> > <td><input type="Checkbox" name="Perm_b_43 " id="edit_ADM"></td> > </tr> > > --- > 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 > --- 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 --- 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
