表单的取消和全选
<html lang&#61;"en">
<head><meta charset&#61;"UTF-8"><meta http-equiv&#61;"X-UA-Compatible" content&#61;"IE&#61;edge"><meta name&#61;"viewport" content&#61;"width&#61;device-width, initial-scale&#61;1.0"><title>Documenttitle>
head>
<body><div class&#61;" wrop"><table><thead><tr><th><input type&#61;"checkbox" id&#61;"all_cheack"> th><th>标题1th><th>标题1th>tr> thead><tbody><tr><td> <input type&#61;"checkbox" class&#61;"a_cheack"> td><td>手机2td><td>手机3td>tr><tr><td> <input type&#61;"checkbox" class&#61;"a_cheack"> td><td>手机2td><td>手机3td>tr><tr><td> <input type&#61;"checkbox" class&#61;"a_cheack"> td><td>手机2td><td>手机3td>tr>tbody>table>div>body>
<script>var inp&#61; document.querySelector("#all_cheack")var a_inp&#61;document.querySelector("tbody").querySelectorAll(".a_cheack")inp.onclick&#61;function (params) {for (let index &#61; 0; index < a_inp.length; index&#43;&#43;) {a_inp[index].checked&#61;this.checked}}for (let i &#61; 0; i < a_inp.length; i&#43;&#43;) {a_inp[i].onclick&#61;function () {var flag&#61;truefor (let i &#61; 0; i < a_inp.length; i&#43;&#43;) {if( !a_inp[i].checked){flag&#61;falseconsole.log("inp.checked1",flag);}}inp.checked&#61;flagconsole.log("inp.checked",inp.checked);}}
script>
html>