当前位置: 代码迷 >> Web前端 >> Jquery兑现的全选 反选
  详细解决方案

Jquery兑现的全选 反选

热度:47   发布时间:2012-08-30 09:55:54.0
Jquery实现的全选 反选

<html>
<head>
??? <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
??? <script>
??? /**jquery实现全选 反选**/
???
???
??? ??? ??? function allCheck(){
??? ??? ??? ??? if($('#allorNo').attr('checked')!='checked'){
??? ??? ??? ??? ??? ??? $("input[name='checkAll']").removeAttr('checked');
??? ??? ??? ??? }else{
??? ??? ??? ??? ??? ??? $("input[name='checkAll']").attr('checked','true');
??? ??? ??? ??? }
??? ??? ??? }
???
??? </script>

</head>
??? <body>
??? <tr>
??? ??? <th><input id="allorNo" type="checkbox" onclick="allCheck();"></th><br>
??? ??? <th><input type="checkbox" name="checkAll">id</th><br>
??? ??? <th><input type="checkbox" name="checkAll">java</th><br>
??? ??? <th><input type="checkbox" name="checkAll">c</th><br>??? ???
??? ??? <th><input type="checkbox" name="checkAll">c++</th><br>
??? ??? <th><input type="checkbox" name="checkAll">php</th><br>
??? ??? <th><input type="checkbox" name="checkAll">java/php/c#</th><br>
??? </tr>
??? </body>
</html>

  相关解决方案