解决方法
尝试这个:
var formobj = document.forms[0]; var counter = 0; for (var j = 0; j < formobj.elements.length; j++) { if (formobj.elements[j].type == "checkBox") { if (formobj.elements[j].checked) { counter++; } } } alert('Total Checked = ' + counter);
.
使用JQuery:
alert($('form input[type=checkBox]:checked').size());