php-general | 2001122
Date: 12/18/01
- Next message: Monte Ohrt: "[PHP] Announcement: Smarty template engine 1.5.2 available"
- Previous message: jimtronic: "Re: [PHP] Arrays/Hashes"
- In reply to: Martin Towell: "RE: [PHP] 'Select All'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Martin,
Excellent, thanks for your help :)
Regards
-- ShaneOn Monday 17 Dec 2001 10:15 pm, Martin Towell wrote: > you _can_ reference it by name - try this: > > <script> > function my_select(type) > { > frm = document.forms.test; > ele = frm["mycheckbox[]"]; > len = ele.length; > for (i = 0; i < len; i++) > ele[i].checked = type; > } > </script> > <form name="test"> > <input type="button" value="All" onClick="my_select(true);"> > <input type="button" value="None" onClick="my_select(false);"> > <input type="checkbox" name="mycheckbox[]"> > <input type="checkbox" name="mycheckbox[]"> > <input type="checkbox" name="mycheckbox[]"> > <input type="checkbox" name="mycheckbox[]"> > </form> > > Martin > > > -----Original Message----- > From: Shane Wright [mailto:me <email protected>] > Sent: Tuesday, December 18, 2001 4:55 AM > To: php-general <email protected> > Subject: [PHP] 'Select All' > > > Hi > > I'm having somewhat of a problem :( > > I have my banks of checkboxes, all named 'mycheckbox[]' with the values as > different IDs. The user happily checks a few of them and my scripts > happily > > process the resulting arrays. > > But... how do I get Javascript to do a 'select all' on them?? I cant > access > them by name because of the square brackets, and I cant access them by > going > > through all form elements in case there are other checkboxes that dont want > to be included. > > Is there a tidy way around this, does any of the above make sense? > > Thanks
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Monte Ohrt: "[PHP] Announcement: Smarty template engine 1.5.2 available"
- Previous message: jimtronic: "Re: [PHP] Arrays/Hashes"
- In reply to: Martin Towell: "RE: [PHP] 'Select All'"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

