xiaodao
05-06-2006, 03:37 PM
i have a form with a lot of checkboxes
how can i click a button or link to check all the checkboxes
how can i click a button or link to check all the checkboxes
|
||||
checkbox problemxiaodao 05-06-2006, 03:37 PM i have a form with a lot of checkboxes how can i click a button or link to check all the checkboxes jonnybinthemix 05-06-2006, 04:37 PM you gotta use javascript to do that im pretty sure it cannot be done in html. something like this might do it: <script language="Javascript"> function checkAll(theForm, cName, check) { for (i=0,n=theForm.elements.length;i<n;i++) if (theForm.elements[i].className.indexOf(cName) !=-1) theForm.elements[i].checked = check; } </script> <form id="myform"> <input type="checkbox" class="filecheck"><br> <input type="checkbox" class="filecheck"><br> <input type="checkbox" class="filecheck"><br> <input type="checkbox" class="filecheck"><br><br> <a href="javascript:checkAll(document.getElementById('myform'), 'filecheck', true);">select all</a> <a href="javascript:checkAll(document.getElementById('myform'), 'filecheck', false);">select none</a> </form> hope this helps. Jon |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum