- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript" src="<a href="http://code.jquery.com/jquery-1.4.4.min.js">http://code.jquery.com/jquery-1.4.4.min.js"></script>
- <script type="text/javascript">
- function selectAll(checkbox) {
- $('input[type=checkbox]').prop('checked', $(checkbox).prop('checked'));
- }
- </script>
- </head>
- <body>
- <input type="checkbox" onclick="selectAll(this);" />全选<br/>
- <input type="checkbox" /><br/>
- <input type="checkbox" /><br/>
- <input type="checkbox" /><br/>
- <input type="checkbox" /><br/>
- <input type="checkbox" /><br/>
- <input type="checkbox" /><br/>
- ……
- </body>
- </html>
- //该片段来自于http://www.codesnippet.cn/detail/190420132910.html
来源: http://www.codesnippet.cn/detail/190420132910.html