Ciao Kodode, ho scritto questo codice sperando che sia la soluzione adatta o almeno che ti possa aiutare nela soluzione del problema. Provala e vedi se è quello che cercavi, se sì ovviamente dovrai adattarla al tuo codice
codice:
<html>
<head>
<script>
function contaCheck()
{
var contaCheckbox=0;
frm = document.getElementById('formCheck');
inp = frm.getElementsByTagName('input');
for (i=0; i<inp.length; i++)
{
if (inp[i].type == 'checkbox')
{
if (inp[i].checked) contaCheckbox++;
}
}
document.getElementById('cellaContatore').innerHTML=contaCheckbox+" Record da stampare";
}
</script>
</head>
<body onLoad="contaCheck()">
<form name="formCheck">
<table>
<tr>
<td>
<input type="checkbox" id="check1" checked onclick=" contaCheck();">
</td>
<td>
record 1
</td<
</tr>
<tr>
<td>
<input type="checkbox" id="check2" checked onclick=" contaCheck();">
</td>
<td>
record 2
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="check3" checked onclick=" contaCheck();">
</td>
<td>
record 3
</td>
</tr>
<tr>
<td>
<input type="checkbox" id="check4" checked onclick=" contaCheck();">
</td>
<td>
record 4
</td>
</tr>
<tr>
<td colspan=2 id="cellaContatore">
</td>
</tr>
<tr>
<td colspan=2 id="cellaContatore">
<input type=Submit value="Conferma">
</td>
</tr>
</table>
</form>
</body>
</html>
Fammi sapere. Ciao Ciao