json
[
{"ID":1,"value":"首页@H_301_9@"},
{"ID":2,255)">滚动@H_301_9@"},
{"ID":3,255)">公告@H_301_9@"}
]
function CreateAjaxCheckBox(Obj,strParaList,url)
{ $.post(url,function (data) { var response = eval("(" + data + ")"); //转换为json对象 var listHtml=''; $.each(response,function(i){ if(response[i].value!="") { listHtml += " <input type='checkBox' "+(strParaList!=""?(strParaList.indexOf(","+response[i].Id+",") >= 0?"checked='checked'":""):"")+" name='"+Obj+"' id='"+Obj+response[i].Id+"' value='"+response[i].Id+"'>"+response[i].value; } }); $("#"+Obj).html(listHtml); }); } 获取值 function GetCheckBoxList(Obj) { var s=""; var r=document.getElementsByName(Obj); for(var i=0;i<r.length;i++){ if(r[i].checked){ s+=r[i].value+","; } } return (s!=''?(','+s+',').replace(',','):'').replace(','); }