展开全部
<body>
<input name="pk1" id="authority" type="checkbox" onClick="checkOne()" value="a1" >一
<input name="pk2" type="checkbox" id="authority" onClick="checkOne()" value="a2" >二
<input name="pk22" type="checkbox" id="authority" onClick="checkOne()" value="a3" >三
<input name="pk23" type="checkbox" id="authority" onClick="checkOne()" value="a4" >四
<input type="checkbox" name="selectAll" onClick='setAll(this)'>全选
</body>
<script language="javascript">
function setAll(o){
setAttribute(document.all.tags("input"),"checked",o.checked);
}
function checkOne()
{
var oas = document.getElementsByName('authority');
for(var i=0;i<oas.length;i++)
{
if(oas[i].checked==false)
{
document.all.selectAll.checked = false;
return;
}
}
document.all.selectAll.checked = true;
}
</script>
<input name="pk1" id="authority" type="checkbox" onClick="checkOne()" value="a1" >一
<input name="pk2" type="checkbox" id="authority" onClick="checkOne()" value="a2" >二
<input name="pk22" type="checkbox" id="authority" onClick="checkOne()" value="a3" >三
<input name="pk23" type="checkbox" id="authority" onClick="checkOne()" value="a4" >四
<input type="checkbox" name="selectAll" onClick='setAll(this)'>全选
</body>
<script language="javascript">
function setAll(o){
setAttribute(document.all.tags("input"),"checked",o.checked);
}
function checkOne()
{
var oas = document.getElementsByName('authority');
for(var i=0;i<oas.length;i++)
{
if(oas[i].checked==false)
{
document.all.selectAll.checked = false;
return;
}
}
document.all.selectAll.checked = true;
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询