<ul id="list">
<li><label><input type="checkbox" value="1"> 1</label></li>
<li><label><input type="checkbox" value="2"> 2</label></li>
<li><label><input type="checkbox" value="3"> 3</label></li>
<li><label><input type="checkbox" value="4"> 4</label></li>
<li><label><input type="checkbox" value="5"> 5</label></li>
<li><label><input type="checkbox" value="6"> 6</label></li>
</ul>
<input type="checkbox" id="all">
<input type="button" value="全选" class="btn" id="selectAll">
引入jq文件
$("#all").click(function(){
if(this.checked){
$("#list :checkbox").prop("checked", true);
}else{
$("#list :checkbox").prop("checked", false);
}
});