abstrakt:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml&quo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標(biāo)題文檔</title>
<style type="text/css">
.box{ width:120px; height:300px; border:1px solid;}
.box div{ border-bottom:1px solid; padding:10px }
.box input{ margin:10px}
</style>
<script type="text/javascript">
function checkall(){
var checkall=document.getElementById("checkall");
var 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>
</head>
<body>
<p>js學(xué)習(xí)</p>
<div class = "box">
<div>
<input type="checkbox" id = "checkall" onclick="checkall(this)"/>全選
</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>
Korrigierender Lehrer:查無此人Korrekturzeit:2019-04-18 09:56:26
Zusammenfassung des Lehrers:完成的不錯,js代碼每行結(jié)束要增加;號。繼續(xù)加油