返回老师我按您讲课......登陆

老师我按您讲课做的,但是全选却选不中,不知道哪里错了

博弈GXY2019-03-16 21:57:22230

<!DOCTYPE html>


<html>


<head>


<meta charset="utf-8">

  <style type="text/css">

.box{width:70px;height:150px;background:green;margin:50px auto;padding-top:10px;padding-left:15px;border-radius:30px 0px 30px 0px;border:5px solid #000;}

.box div{border-bottom:3px solid #ccc;margin:5px auto;padding-bottom:5px;}

.box input{margin:2px;}

</style>

<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=ture;

   }else{

   item[i].checked=false;

   }

}


}


</script>

<title>这是我的选项作业</title>


</head>

<body>

<div class="box">

<div>

<input type="checkbox" id="checkall" onclick="checkAll()"><label for="checkall">全选</label>

</div>

<input type="checkbox" name="item[]">英语<br/>

<input type="checkbox" name="item[]">语文<br/>

<input type="checkbox" name="item[]">数学<br/>

<input type="checkbox" name="item[]">物理<br/>

<input type="checkbox" name="item[]">化学<br/>

</div>

</body>

</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送