shamsuljewel Posted October 27, 2007 Share Posted October 27, 2007 I am use this code while(($row=mysql_fetch_array($q1)) && $c < $limit) { echo "<tr><td width='1%' colspan='20'><input type='checkbox' name='contact_select[]' value='$row[id]'> $c++; } set of contact list from database I want to check all or uncheck all by button click I am using <input type="button" name="CheckAll" value="Check All" onClick="checkAll(document.action.contact_select)"> <input type="button" name="UnCheckAll" value="Uncheck All" onClick="uncheckAll(document.action.contact_select)"> this does not work but if I just remove the [] <input type='checkbox' name='contact_select' value='$row[id]'> it works but I need [] for delete the particular item...so how do I select all ..any idea? Quote Link to comment Share on other sites More sharing options...
lighton Posted November 3, 2007 Share Posted November 3, 2007 //check one, check all function selectAll() { var box = document.getElementsByName('contact_select[]'); if(box) { var boxes = box.length; for(var i = 0; i < boxes; i++) { if(box[i].checked) { box[i].checked = false; } else { box[i].checked = true; } } } } onclick="selectAll() ;" should work Quote Link to comment Share on other sites More sharing options...
shamsuljewel Posted November 3, 2007 Author Share Posted November 3, 2007 Thank You very much IT works!!!! Quote Link to comment Share on other sites More sharing options...
lighton Posted November 5, 2007 Share Posted November 5, 2007 your welcome Quote Link to comment Share on other sites More sharing options...
prakash Posted January 30, 2008 Share Posted January 30, 2008 nice solution just helped me thanks lighton Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.