Era scritto malissimo… Cmq ci avevi azzeccato

codice:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Pagina vuota</title>
<script type="text/javascript">
function anyCheck(oForm) {
for (var iChBx = 0, nCount = 0, nChBxs = oForm["ckbox[]"].length; iChBx < nChBxs; iChBx++) {
if (oForm["ckbox[]"][iChBx].checked) { nCount += 1; }
}
alert("You selected " + nCount + " boxes.");
}
</script>
</head>
<body>
<form method="post" name="playlist" action="">
<fieldset>
<legend>Conta checkbox</legend>
2<input type="checkbox" name="ckbox[]" value="2" onclick="anyCheck(this.form);">
3<input type="checkbox" name="ckbox[]" value="3" onclick="anyCheck(this.form);">
4<input type="checkbox" name="ckbox[]" value="4" onclick="anyCheck(this.form);"></p>
<input type="submit" value="Count Checkboxes"></p>
</fieldset>
</form>
</body>
</html>