// 设置选中
function setCheckboxClick(obj)
{
	if(obj == null)
	{
		$.messager.alert(‘警告‘, "请选择要设置选中的项!",‘warning‘);
	}
	
 	// alert(obj.value);
	var authorityId = obj.value;
	
	$.ajax({
		type: ‘post‘,
		url:  ‘getAuthorityByAuthorityId.action‘,
		data: {"authorityId" : authorityId},
		dataType: ‘json‘,
		success:function(data)
		{
			console.info(data);
			var d = $.parseJSON(data);
			
			//$(":checkbox[name=authorityId]").prop("checked",false);		
//			obj.checked = true;
			$(":checkbox[name=authorityId]").each(function(){
				var currentAuthorityId = $(this).val();
				for(var i = 0; i < d.length; i++)
				{
					if(currentAuthorityId == d[i].authorityId)
					{
//						$(this).prop("checked",true);
						if ($(this).prop("checked") == true) 
						{
							$(this).prop("checked", false);
		                }
						else 
						{
							$(this).prop("checked",true);
		                }
					}
				}
			});
		},
		error:function()
		{			
		}
});JS 设置复选框的选中与取消选中
原文:http://www.cnblogs.com/rgcdlb/p/7194095.html