日期:2014-05-16 浏览次数:20401 次
<html> <head> <title></title> <script type="text/javascript"> function checkAll(){ for (var i = 0; i < document.getElementsByName("checkItem").length; i++) { document.getElementsByName("checkItem")[i].checked = document.getElementById("all").checked; } } </script> </head> <body> <form> <table > <tr> <td><input type="checkbox" name="all" id="all" onclick="checkAll()"/>Select All</td> </tr> <tr> <td><input type="checkbox" name="checkItem" value="value1"/></td> </tr> <tr> <td><input type="checkbox" name="checkItem" value="value2"/></td> </tr> <tr> <td><input type="checkbox" name="checkItem" value="value3"/></td> </tr> <tr> <td><input type="checkbox" name="checkItem" value="value4"/></td> </tr> <table > </form> </body> </html>