<html>
<body>
<script language="javascript">
function selectAll()
{
var arrObj = document.all;
for(var i = 0; i < arrObj.length;i++)
{
if(typeof arrObj[i].type != "undefined" && arrObj[i].type=='checkbox') arrObj[i].checked =true;
}
}
function unSelectAll()
{
var arrObj = document.all;
for(var i = 0; i < arrObj.length;i++)
{
if(typeof arrObj[i].type != "undefined" && arrObj[i].type=='checkbox') arrObj[i].checked =false;
}
}
</script>
<input type=checkbox value=checkbox1 value="1">
<input type=checkbox value=checkbox1 value="2">
<input type=checkbox value=checkbox1 value="3">
<input type=checkbox value=checkbox1 value="4">
<input type=checkbox value=checkbox1 value="5">
<input type=checkbox value=checkbox1 value="6">
<input type="button" value="全选" onClick="selectAll()">
<input type="button" value="全部不选" onClick="unSelectAll()">
</body>
</html>
全选多选框
最新推荐文章于 2024-08-12 10:01:44 发布