<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#all").click(function () { $(":checkbox").attr("checked", true); }); $("#not").click(function () { $(":checkbox").attr("checked", false); }); $("#btn").click(function () { $(":checkbox").each(function () { $(this).attr("checked",!$(this).attr("checked")) }); }); }); </script> </head> <body> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="button" id="all" value="全选" /> <input type="button" id="not" value="不选" /> <input type="button" id="btn" value="反选" /> </body> </html>