counting checkboxes from an javascript function

This JavaScript function is in the webpage I am calling:\[code\]function getChecked(button, form) { var name; for (i = 0; i < document.forms['CheckForm'].list.length; i++) { name = "Check" + (i+0); if(document.forms['CheckForm'].list.checked == true) { if(name == "Check0") form.Check0.value = "http://stackoverflow.com/questions/14410235/2437315"; else if(name == "Check1") form.Check1.value = "http://stackoverflow.com/questions/14410235/2437104"; else if(name == "Check2") form.Check2.value = "http://stackoverflow.com/questions/14410235/2434936"; else if(name == "Check3") form.Check3.value = "http://stackoverflow.com/questions/14410235/2434574"; else if(name == "Check4") form.Check4.value = "http://stackoverflow.com/questions/14410235/2433541"; else if(name == "Check5") form.Check5.value = "http://stackoverflow.com/questions/14410235/2426021"; }\[/code\]Sometimes there are 6 checks, sometimes 7 sometimes 3, I need help in counting how many Check(Somenumber) there is and then build an post field with Check0=0&Check1=0&Check2=0 and so on.I am not setting each check to different value, I need to count how many Checkboxes there are and then set them to 0, I am using PHP to cURL the page.
 
Back
Top