<script> //点击全选,子复选框被选中 function demo(){ var allcheck=document.getElementById("allcheck"); var choice=document.getElementsByName("choice"); for(var i=0;i<choice.length;i++){ choice[i].checked=allcheck.checked; } } //点击子复选框,全选框…
<input type="checkbox" onclick="checkboxOnclick(this)" /> <script> function checkboxOnclick(checkbox){ if ( checkbox.checked == true){ //Action for checked }else{ //Action for not checked } } </script> 轉載:https://blog…