View Full Version : select all

03-22-2005, 10:11 AM

i have a html page in which a set of check boxes built dynamically from the database. even the names and values r from the database. i wanna have another check box , when i select it all other check boxes should also be selected.

please help

03-22-2005, 10:55 AM
How are the dynamic checkboxes named? Sequentially or named the same? If the names or values don't form a pattern, there is still a solution if you don't have other checkboxes in the page other than those that need to be auto-selected.

03-22-2005, 11:37 AM
the check box's values and names are very diffrent,

but these are the only check boxes i have in my page.

there are no other check boxes.



03-22-2005, 11:57 AM
function checkUncheckAll(oMasterChk){
var chked = oMasterChk.checked;
var chks = document.getElementsByTagName('input');
for (var i=0; i<chks.length; i++){
chks[i].checked = chked;
oMasterChk.title = (chked) ? "Uncheck all" : "Check all";
<input type="checkbox" name="master" onclick="checkUncheckAll(this)" title="Check all" />