1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
function checkAllCheckboxesInTable( inputId, state ){
var commonIdPart = inputId.substr(0, inputId.lastIndexOf(':'));
var tableId = commonIdPart;
var tableElement = document.getElementById( tableId );
var inputs = tableElement.getElementsByTagName('input');
for (var i = 0; i <= inputs.length; i++){
var input = inputs[i];
if( input.getAttribute('type') == 'checkbox' && input.getAttribute('disabled') != 'disabled'){
if (state == false) {
input.removeAttribute('checked');
} else {
input.setAttribute('checked', state);
}
}else{
input.removeAttribute('checked');
}
}
} |