标签:color fhs dsv eww oql evb lol esc moc
例子
例子
例如对象遍历实现全选
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>对象遍历全选和全不选</title> <script src="../js/jquery-1.8.3.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $(function(){ $("#quanxuan").click(function(){ // 变量使用与JS一样 var sta = this.checked; // 对象遍历方式遍历所有满足条件的元素 $("body table #ren").each(function(){ this.checked=sta; }); }); }); </script> </head> <body> <font id="p11" color="#000000">WWW</font> <table border="1px" width="400px" align="center"> <tr> <th>全选:<input type="checkbox" name="quanxuan" id="quanxuan" value="" onclick="change()"/></th> <th>编号</th> <th>姓名</th> <th>年龄</th> </tr> <tr> <td><input type="checkbox" name="ren" id="ren" value="" /></td> <td>1</td> <td>qqq</td> <td>25</td> </tr> <tr> <td><input type="checkbox" name="ren" id="ren" value="" /></td> <td>1</td> <td>qqq</td> <td>25</td> </tr> <tr> <td><input type="checkbox" name="ren" id="ren" value="" /></td> <td>1</td> <td>qqq</td> <td>25</td> </tr> <tr> <td><input type="checkbox" name="ren" id="ren" value="" /></td> <td>1</td> <td>qqq</td> <td>25</td> </tr> </table> </body> </html>
例子:
标签:color fhs dsv eww oql evb lol esc moc
原文地址:http://www.cnblogs.com/qlqwjy/p/7351204.html