サマリー:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>quanxuan</title><style>.box{margin:0 auto;width: 120px;height: 250px;background: #ccc;border
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>quanxuan</title> <style> .box{ margin:0 auto; width: 120px; height: 250px; background: #ccc; border: 1px solid pink; border-radius: 5px; padding: 10px; } .box div{ border-bottom:1px solid black; padding-bottom: 10px; margin-bottom: 8px; } .box input{ margin: 10px; } </style> <script> function checkAll(){ let checkall,i; checkall=document.getElementById("checkall"); i=document.getElementById("ie") for(var n=0;n<i.length;n++){//id"ie"的長度做一個循環(huán) if (checkall.checked) { //假設(shè)‘全選’被選擇 i[n].checked=true;// }else{ i[n].checked=false; } } } </script> </head> <body> <div> <div> <input type="checkbox" id="checkall" onclick="checkAll()">全選 </div> <input type="checkbox" id="ie">選項(xiàng)1 <br> <input type="checkbox" id="ie">選項(xiàng)2 <br> <input type="checkbox" id="ie">選項(xiàng)3 <br> <input type="checkbox" id="ie">選項(xiàng)4 <br> <input type="checkbox" id="ie">選項(xiàng)5 </div> </body> </html>
添削の先生:查無此人添削時間:2019-01-14 16:17:50
先生のまとめ:完成的不錯。養(yǎng)成好習(xí)慣,把代碼縮進(jìn),加點(diǎn)注釋。加油。