<!DOCTYPE html PUBLIC "//WC//DTD XHTML Transitional//EN" "
<html xmlns="<head><meta httpequiv="ContentType" content="text/html; charset=utf" /><title>复选框的全选反选全不选</title><style>body{ margin:px;}</style><script language="javascript" type="text/javascript" src="/script/jqueryminjs"></script><script>$(function(){ $("input[value=全选]")click(function(){ $("input[type=checkbox]")attr("checked"true); }) $("input[value=全不选]")click(function(){ $("input[type=checkbox]")attr("checked"false); }) $("input[value=反选]")click(function(){ $("input[type=checkbox]")each(function(){ $(this)attr("checked"!$(this)attr("checked")); }) }) })</script></head><body><div id="div"><input type="checkbox" />苹果<input type="checkbox" />香蕉<input type="checkbox" />菠萝<input type="checkbox" />草莓<input type="checkbox" />梨子<br /><input type="button" value="全选" /><input type="button" value="反选" /><input type="button" value="全不选" /></div></body></html>