亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript核心片

Original 2019-06-13 16:00:48 321
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>javascript</title><style type="text/css"> .box{width:120px;height:250px;border:1px

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>javascript</title>

<style type="text/css">

.box{width:120px;height:250px;border:1px solid #000;border-radius:5px;padding:5px 10px;margin:20px auto;}

.box div{border-bottom:1px solid #000;padding-bottom:10px;margin-bottom:8px;}

.box input{margin:8px;}

</style>

<script type="text/javascript">

function checkall(){

var checkall,item;

checkall=document.getElementById('checkall')

item=document.getElementByName("item[]")

for (var i=0;i<item.length;i++){

if(checkall.checked){

item[i].checked=true

}else{

item[i].checked=false

}

}

}

</script>


</head>

<body>

<div class="box">

<div>

<input type="checkbox" id="checkall" onclik="checkAll()"><lable for="checkall">全選</lable>

</div>

<input type="checkbox" name="item[]">選擇1<br>

    <input type="checkbox" name="item[]">選擇2<br>

    <input type="checkbox" name="item[]">選擇3<br>

    <input type="checkbox" name="item[]">選擇4<br>

    <input type="checkbox" name="item[]">選擇5<br>

    <input type="checkbox" name="item[]">選擇6<br>

    <input type="checkbox" name="item[]">選擇7<br>

</div>

</body>

</html>


Correcting teacher:天蓬老師Correction time:2019-06-13 17:08:04
Teacher's summary:全選 的精華在于chebox的name屬性的值,要通過(guò)一個(gè)數(shù)組來(lái)存儲(chǔ), 這樣才可以實(shí)現(xiàn)多選

Release Notes

Popular Entries