abstract:1.html代码<div class= "chek"><div><input type="checkbox" id="checkAll" onclick="checkAll()"/><label>全选</label></div&g
1.html代码
<div class= "chek">
<div><input type="checkbox" id="checkAll" onclick="checkAll()"/><label>全选</label></div>
<input type="checkbox" name = "item[]">选择1<br>
<input type="checkbox" name = "item[]">选择2<br>
</div>
2.js代码
<script>
funtion checkAll() {
var check = document.getElementByClassName("chek")
var item = document.getElementByName("item[]");
for (var i =0;i<item.length;i++){
if ( checkAll.checked ){
item[i].checked = ture;
}
}
}
</script>
3.然后给最外层div添加边框等属性,以及全选下有一个下划线,可以用border-bottom去实现。
Correcting teacher:查无此人Correction time:2019-05-17 09:35:02
Teacher's summary:完成的不错。每行js语句结束增加;号。继续加油