Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Select/Unselect all | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Mercury Shyguy Level: 16 Posts: 35/88 EXP: 18132 For next: 2124 Since: 07-08-04 From: Hihihi. Since last post: 1 day Last activity: 1 day |
| ||
I know you have to do it in Javascript, and I've search around a bit for free scripts, but none kinda worked . How could I select or unselect all checkboxes on a form with one click? |
|||
neotransotaku Baby Mario 戻れたら、 誰も気が付く Level: 87 Posts: 1449/4016 EXP: 6220548 For next: 172226 Since: 03-15-04 From: Outside of Time/Space Since last post: 11 hours Last activity: 1 hour |
| ||
I believe it is related to DOM manipulation and you have to get a hold of all the checkboxes, and for each checkbox, you set it. Although the following information is for Mozilla, the same approach works for IE: Explanation of relationship between DOM and Javascript DOM information from W3 |
|||
Modereb Paragoomba Level: 15 Posts: 67/75 EXP: 14749 For next: 1635 Since: 06-04-04 Since last post: 350 days Last activity: 339 days |
| ||
Originally posted by neotransotakuYou're been talking about the DOM in almost every JavaScript related thread lately but you rarely come up with an actually useful answer... Anyway... <form name="cboxform"> <input type="checkbox" name="cbox1" /> Checkbox 1 <input type="checkbox" name="cbox2" /> Checkbox 2 <input type="checkbox" name="cbox3" /> Checkbox 3 <input type="button" value="Select all" onclick="document.forms.cboxform.cbox1.checked=1; document.forms.cboxform.cbox2.checked=1; document.forms.cboxform.cbox3.checked=1;" /> <input type="button" value="Unselect all" onclick="document.forms.cboxform.cbox1.checked=0; document.forms.cboxform.cbox2.checked=0; document.forms.cboxform.cbox3.checked=0;" /> </form> |
|||
Mercury Shyguy Level: 16 Posts: 37/88 EXP: 18132 For next: 2124 Since: 07-08-04 From: Hihihi. Since last post: 1 day Last activity: 1 day |
| ||
Thanks, very helpful ! | |||
Zem You can be civil without being flowery, dipshits. Level: 49 Posts: 215/1107 EXP: 829398 For next: 54485 Since: 06-13-04 Since last post: 131 days Last activity: 131 days |
| ||
If you're using a script (e.g. php) which could generate any number of checkboxes, it's more efficient to run through every element in the form and check it if it's a checkbox. Not that I remember how to do that, but I thought I'd point that out. =( |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Select/Unselect all | | | |