<input type="checkbox" id="all" />全选<br />
<input type="checkbox" name="sub" />image1.jpg<br />
<input type="checkbox" name="sub"/>image2.jpg<br />
<input type="checkbox" name="sub"/>image3.jpg<br />
<input type="checkbox" name="sub"/>image4.jpg<br />
<script>
$("#all").on('click',function() {
$("input[name='sub']").prop("checked", this.checked);
});
</script>