摘要:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>全选</title> <style type="text/css"> .box{width: 650px;b
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>全选</title> <style type="text/css"> .box{width: 650px;border: 1px solid #000;border-radius: 5px;margin: 100px auto;padding: 20px;} .box input{margin: 10px;} </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=true; }else{ item[i].checked=false; } } } </script> </head> <body> <div class="box"> <span>请选择分类</span> <div> <input type="checkbox" id="checkall" onclick="checkAll()"><label for="checkall">全选</label> </div> <input type= "checkbox" name="item[]"> PHP <input type= "checkbox" name="item[]"> MySQL <input type= "checkbox" name="item[]"> HTML <input type= "checkbox" name="item[]"> CSS <input type= "checkbox" name="item[]"> JavaScript <input type= "checkbox" name="item[]"> jQuery <input type= "checkbox" name="item[]"> AJAX <input type= "checkbox" name="item[]"> Html5 <input type= "checkbox" name="item[]"> CSS3 <input type= "checkbox" name="item[]"> Linux <input type= "checkbox" name="item[]"> Redis <input type= "checkbox" name="item[]"> Mencached </div> </body> </html>
学习javascript的脚步快了些,老师讲述的Javascript事件还未逐个去使用掌握,对css的排版并没有很熟练!未能达到自己想要的结果,对知识点掌握的不够透彻吧!还有写代码也不够仔细,少了个}找了半天,头大。
批改老师:灭绝师太批改时间:2018-11-11 09:38:11
老师总结:慢慢来 新手都会遇到这种问题 一遍不行两遍……基础打好,后面就会好很多