Модуль для оптимизации размера JavaScript кода, убирая комментарии и сокращая длину переменных.URL: http://search.cpan.org/dist/JavaScript-Squish/
Обсуждается: http://www.opennet.me/prog/info/3032.shtml
function checkAllFields(ref) {
var chkAll = document.getElementById('checkAll');
var checks = document.getElementsByName('reset[]');
var removeButton = document.getElementById('removeChecked');
var boxLength = checks.length;
var allChecked = false;
var totalChecked = 0;
if ( ref == 1 ) {
if ( chkAll.checked == true ) {
for ( i=0; i < boxLength; i++ ) {
checks[i].checked = true;
}
} else {
for ( i=0; i < boxLength; i++ ) {
checks[i].checked = false;
}
}
} else {
for ( i=0; i < boxLength; i++ ) {
if ( checks[i].checked == true ) {
allChecked = true;
continue;
} else {
allChecked = false;
break;
}
}
if ( allChecked == true ) {
chkAll.checked = true;
} else {
chkAll.checked = false;
}
}
for ( j=0; j < boxLength; j++ ) {
if ( checks[j].checked == true ) {
totalChecked++;
}
}
removeButton.value = "Nulstil ["+totalChecked+"] markeret";
}
function checkAllFields(ref) {
var chkAll = document.getElementById('checkAll');
var checks = document.getElementsByName('reset[]');
var removeButton = document.getElementById('removeChecked');
var boxLength = checks.length;
var allChecked = false;
var totalChecked = 0;
if ( ref == 1 ) {
if ( chkAll.checked == true ) {
for ( i=0; i < boxLength; i++ ) {
checks[i].checked = true;
}
} else {
for ( i=0; i < boxLength; i++ ) {
checks[i].checked = false;
}
}
} else {
for ( i=0; i < boxLength; i++ ) {
if ( checks[i].checked == true ) {
allChecked = true;
continue;
} else {
allChecked = false;
break;
}
}
if ( allChecked == true ) {
chkAll.checked = true;
} else {
chkAll.checked = false;
}
}
for ( j=0; j < boxLength; j++ ) {
if ( checks[j].checked == true ) {
totalChecked++;
}
}
removeButton.value = "Nulstil ["+totalChecked+"] markeret";
}