Tipo questo?
codice:
<form name="checkboxes" id="checkboxes" method="POST" action="elabora.php">
<input type="checkbox" name="checkbox[1]" id="checkbox1" value="100" />Campo 1
<input type="checkbox" name="checkbox[2]" id="checkbox2" value="200" />Campo2
<input type="checkbox" name="checkbox[3]" id="checkbox3" value="300" />Campo3
<input type="checkbox" name="checkbox[4]" id="checkbox4" value="400" />Campo4
<input type="submit" value="Aggiungi" />
</form>
CLICCA PER TESTARE
<script>
function boh(){
var wrapper=document.getElementById('checkboxes');//è l' id della form
window['checkflaggati']=[]; window['tuttiicheck']=[]; window['sommacheck']=0;/*variabli globali, più semplice per te, forse*/
for(var i=0, e=wrapper.getElementsByTagName('INPUT'); i<e.length; i++){
if(e[i].type=="checkbox"){
window['tuttiicheck'][++window['tuttiicheck'].length-1]=e[i].value;/*io uso ++length-1, concettualmente più giusto*/
if(e[i].checked){
window['checkflaggati'][++window['checkflaggati'].length-1]=e[i].value;
window['sommacheck']+=parseInt(e[i].value);
};
};
}
}
</script>