jQuery.fn.extend({check:function(mode){varmode=mode||'on';returnthis.each(function(){switch(mode){case'on':this.checked=true;break;case'off':this.checked=false;break;case'toggle':this.checked=!this.checked;break;}});}}); 当你看了jQuery里面的代码和API,就知道是什么回事了.是不是更微软的Ajax Library的写法类似呢!这个是全选和取消全选的方法.调用方法: $("input[@type='checkbox']").check('toggle');