PHP全选按钮

<body>
<input type="checkbox"  id="qx"  onclick="qxx(this,'qx')"/>全选
<input type="checkbox"  class="qx"  />内容
<input type="checkbox"  class="qx"  />内容
<input type="checkbox"  id="qy"  onclick="qxx(this,'qy')"/>全选
<input type="checkbox"  class="qy"  />内容
<input type="checkbox"  class="qy"  />内容
</body>
<script>
function qxx(a,b)  //a代表点击的 b代表class名称
{
    var a=a.checked;
    var b=document.getElementsByClassName(b);
    for(var i=0;i<b.length;i++)
    {
        b[i].checked=a;
    }
}

</script>
</html>
原文地址:https://www.cnblogs.com/zbxiaoxu/p/5477295.html