btnId:操作按钮
allChkId:全选按钮
singleChkId:单选按钮
function initMulSel(btnId,allChkId,singleChkId)
{
input=function(){
var objstr="input[name="+arguments[0]+"]";
if(arguments[1]!=undefined)objstr+=arguments[1];
return $(objstr);
};
input(allChkId).click(function(){
input(singleChkId).attr("checked",input(allChkId).attr("checked"));
doAction();
});
input(singleChkId).click(function(){
doAction();
});
doAction=function(){
var checkedCount=input(singleChkId,"[checked]").size();
var count=input(singleChkId).size();
var boolean_button=(count==0||checkedCount==0);
var boolean_all=(checkedCount==count&&count!=0);
input(btnId).attr("disabled",boolean_button);
input(allChkId).attr("checked",boolean_all);
}
doAction();
}