I can not hit the code below: the total variable does not add to countCheckedCheckboxes. And when you click the mark button all but uncheck some and click the button again that which was marked decollects and what was demarcated is marked.
SCRIPT
var total=0;
function checkAll(theForm, cName) {
for (i=0,n=theForm.elements.length;i<n;i++){
if (theForm.elements[i].className.indexOf(cName) !=-1)
theForm.elements[i].checked = !(theForm.elements[i].checked);
}
total = $('input[type=checkbox]:checked').length;
}
$(document).ready(function(){
var $checkboxes = $('#checkbox_form td input[type="checkbox"]');
$checkboxes.change(function(){
var countCheckedCheckboxes = $checkboxes.filter(':checked').length;
countCheckedCheckboxes=(countCheckedCheckboxes+total);
$('#count-checked-checkboxes').text(countCheckedCheckboxes);
});
});