国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

JavaScript全選checkbox選項(xiàng)-20190726

Original 2019-07-26 17:10:27 277
abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Javascript全選</title> <style type="text/css"> .box{width:120px;h
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Javascript全選</title>
<style type="text/css">
.box{width:120px;height:250px;border:1px solid #ccc;border-radius:5px;padding:0px 10px;margin:20px auto;}
.box div{border-bottom:1px solid #000;padding-bottom:10px;margin-bottom:8px;}
.box input{margin:8px;}
</style>
</head>
<body>
<div>
<div>
<input type="checkbox" id="checkall" onclick="checkall(this)"><label for="checkall">全選</label>
</div>
<input type="checkbox" name="item[]">選項(xiàng)1<br>
<input type="checkbox" name="item[]">選項(xiàng)2<br>
<input type="checkbox" name="item[]">選項(xiàng)3<br>
<input type="checkbox" name="item[]">選項(xiàng)4<br>
<input type="checkbox" name="item[]">選項(xiàng)5<br>
<input type="checkbox" name="item[]">選項(xiàng)6<br>
</div>
<script type="text/javascript">
function checkall(){
var checkall,item;
checkall=document.getElementById('checkall');
item=document.getElementsByName("item[]");
for(var i=0;i<item.length;i++){
if(checkall.checked){
item[i].checked=true;
}else{
item[i].checked=false;
}

}
}
</script>
</body>
</html>


Correcting teacher:查無(wú)此人Correction time:2019-07-27 11:21:46
Teacher's summary:完成的不錯(cuò)。如果是商城的購(gòu)物車,全選還要統(tǒng)計(jì)商品總價(jià)。繼續(xù)加油。

Release Notes

Popular Entries