1<script language="javascript">
2function selectAll()
3{
4}
5
6function unSelectAll()
7{
8
9}
10</script>
1<input type="checkbox" value="1"/>
1<input type="checkbox" value="2"/>
1<input type="checkbox" value="3"/>
1<input type="checkbox" value="4"/>
1<input type="checkbox" value="5"/>
1<input type="checkbox" value="6"/>
1<input onclick="selectAll()" type="button" value="全选"/>
1<input <form="" \---------------------------------------------------------------="" name="frm" onclick="unSelectAll()" type="button" value="全撤" 如何在javascript上实现全部选择和撤销全部选择=""/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
1<input name="m" type="checkbox"/>
全选
1<input onclick="mm(this)" type="checkbox" value="Check All"/>
1<script language="javascript">
2function mm(o)
3{
4var a = document.frm("m");
5for (var i=0; i<a.length; i++){
6a[i].checked = o.checked;
7}
8
9}
10</script>
---------------------------------------------------------------
1<html><body>
2<script language="javascript">
3function selectAll()
4{
5var arrObj = document.all;
6for(var i = 0; i < arrObj.length;i++)
7{
8
9if(typeof arrObj[i].type != "undefined" && arrObj[i].type=='checkbox') arrObj[i].checked =true;
10}
11}
12
13function unSelectAll()
14{
15var arrObj = document.all;
16for(var i = 0; i < arrObj.length;i++)
17{
18if(typeof arrObj[i].type != "undefined" && arrObj[i].type=='checkbox') arrObj[i].checked =false;
19}
20}
21</script>
22<input type="checkbox" value="1"/>
23<input type="checkbox" value="2"/>
24<input type="checkbox" value="3"/>
25<input type="checkbox" value="4"/>
26<input type="checkbox" value="5"/>
27<input type="checkbox" value="6"/>
28<input onclick="selectAll()" type="button" value="ȫѡ"/>
29<input onclick="unSelectAll()" type="button" value="È«³·"/>
30</body>
31</html>
---------------------------------------------------------------
1<script>
2function CheckAll()
3{
4for(var i=0;i<document.frmResult.elements.length;i++){
5var e=document.frmResult.elements[i];
6if (e.name != 'chkall')
7e.checked = document.frmResult.chkall.checked;
8}
9}
10</script>
1<form action="clear_fav.php" method="get" name="frmResult">
2<input type="checkbox" value="1"/>
3<input type="checkbox" value="2"/>
4<input type="checkbox" value="3"/>
5<input type="checkbox" value="4"/>
6<input type="checkbox" value="5"/>
7<input type="checkbox" value="6"/>
8<br/>
9<input name="chkall" onclick="CheckAll()" type="checkbox"/>
10全部选中<br/>
11</form>