.net 环境下可以使用的全选和反全选
代码
1 <script type="text/javascript">
2 function checkall() {
3 var buttoncheck = document.getElementById("buttonCheck");
4 if (buttoncheck.innerHTML == '[全选]') {
5 check(true);
6 buttoncheck.innerHTML = '[全不选]';
7 }
8 else {
9 check(false);
10 buttoncheck.innerHTML = '[全选]';
11 }
12 }
13
14 function check(select) {
15 var allInputs = document.forms[0].tags('INPUT');
16 for (var k = 0; k < allInputs.length; k++) {
17 if (allInputs[k].type == "checkbox") {
18 allInputs[k].checked = select;
19 }
20 }
21 }
22 </script>
2 function checkall() {
3 var buttoncheck = document.getElementById("buttonCheck");
4 if (buttoncheck.innerHTML == '[全选]') {
5 check(true);
6 buttoncheck.innerHTML = '[全不选]';
7 }
8 else {
9 check(false);
10 buttoncheck.innerHTML = '[全选]';
11 }
12 }
13
14 function check(select) {
15 var allInputs = document.forms[0].tags('INPUT');
16 for (var k = 0; k < allInputs.length; k++) {
17 if (allInputs[k].type == "checkbox") {
18 allInputs[k].checked = select;
19 }
20 }
21 }
22 </script>