Return array of all checked checkboxes

All checkboxes on form

HTML

Check the web site programming language you know:
<form action="script.php" method="post">

<input type="checkbox" onclick='getColorsSelected(1)' name="chb[]" value="html" />HTML<br/>
<input type="checkbox" onclick='getColorsSelected(2)' name="chb[]" value="css" />CSS<br/>
<input type="checkbox" onclick='getColorsSelected(3)' name="chb[]" value="javascript" />JavaScript<br/>
<input type="checkbox" onclick='getColorsSelected(4)' name="chb[]" value="php" />php<br/>
<input type="checkbox" onclick='getColorsSelected(5)' name="chb[]" value="python" />Python<br/>
<input type="checkbox" name="chb[]" value="net" />Net<br/>
<input type="button" value="Click" id="btntest" />

</form>

JavaScript

// Returns an array with values of the selected (checked) checkboxes in "frm"
function getColorsSelected(frm) {
  var selchbox = [];        // array that will store the value of selected checkboxes
	
  alert('tes');	
  
	//alert(frm);

  // gets all the input tags in frm, and their number
  /* var inpfields = frm.getElementsByTagName('input');
  var nr_inpfields = inpfields.length;
   
  for(var i=0; i<nr_inpfields; i++) {
    if(inpfields[i].type == 'checkbox' && inpfields[i].checked == true) selchbox.push(inpfields[i].value);
  }
  return selchbox; */
  
}

  /* Test this function */