Prova cosi....
Non è quello che hai chiesto ma la struttura da usare c'è
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function selectAll(aCheckbox) {
nbFils = document.body.children.length;
for(i=0;i<nbFils;i++) {
curObj = document.body.children(i);
if (curObj.tagName == 'INPUT' && curObj.type == 'checkbox' && curObj.name == aCheckbox.name.substr(1,2)) {
curObj.checked = aCheckbox.checked;
} // if (curObj.tagName == 'INPUT' && curObj.type == 'checkbox' && curObj.name == aCheckbox.name.substr(1,2))
} // for(i=0;i<nbFils;i++)
return true;
} // function compteCheck(aDiv)
function blockParent(aCheckbox) {
document.getElementById('p'+ aCheckbox.name).checked = aCheckbox.checked;
} // function blockParent(aCheckbox)
//-->
</script>
</head>
<body>
<input type="checkbox" onclick="selectAll(this)" name="pg1" id="s01">Select all
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c01">un
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c02">deux
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c03">trois
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c04">quatre
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c05">cinq
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c06">six
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c07">sept
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c08">huit
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c09">neuf
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c10">dix
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c11">onze
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c12">douze
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c13">treize
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c14">quatorze
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c15">quinze
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c16">seize
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c17">dix-sept
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c18">dix-huit
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c19">dix-neuf
<input type="checkbox" onclick="blockParent(this)" name="g1" id="c20">vingt
</body>
</html>