<input type="checkbox" onClick="checkAll(this)"/><b>Tout cocher/décocher</b>
<br/>
<input type="checkbox" name="ch" value="bar1"> Checkbox 1<br/>
<input type="checkbox" name="ch" value="bar2"> Checkbox 2<br/>
<input type="checkbox" name="ch" value="bar3"> Checkbox 3<br/>
<input type="checkbox" name="ch" value="bar4"> Checkbox 4<br/>
function checkAll(source) {
  checkboxes = document.getElementsByName('ch');
  for(var i=0, n=checkboxes.length;i<n;i++) {
    checkboxes[i].checked = source.checked;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.