PHP全选按钮

<body>
<input type="checkbox"  >全选
<input type="checkbox"  class="qx"  />内容
<input type="checkbox"  class="qx"  />内容
<input type="checkbox"  >全选
<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>