I have the following HTML:
<form name="smform" id="smform" method="post" action="">
      <input type="checkbox" name="Check_All" onClick="Check(document.smform.check)"  >
     <input type="checkbox" name="check" value="blue_color"> Blue<br>
     <input type="checkbox" name="check" value="green_color"> Green<br>
     <input type="checkbox" name="check" value="orange_color"> Orange<br>
</form>
With the this JS:
function Check(chk)
    {
        if(document.smform.Check_All.checked){
        for (i = 0; i < chk.length; i++)
        chk[i].checked = true ;
        document.smform.Check_All.checked = true;
    }else{
        for (i = 0; i < chk.length; i++)
        chk[i].checked = false ;
        document.smform.Check_All.checked = false;
    }
}
And this this is working fine, I can select or deselect all checkboxes, but in order to post this as an ARRAY, my check boxes will have the name="check[]" like:
     <input type="checkbox" name="check[]" value="blue_color"> Blue<br>
     <input type="checkbox" name="check[]" value="green_color"> Green<br>
     <input type="checkbox" name="check[]" value="orange_color"> Orange<br>
But in this case my JS is not working. How can I adapt this JS so it works with name="check[]" ?
All help is appreciated.
 
     
     
     
    