function initCheckBox(name){
    //从数据库中取出来的以逗号分隔的复选框的值
    var ids = "1,2,3";
    var workdaysArr = ids.split(",");
    for (var j = 0; j < workdaysArr.length; j++) {
        var cbthis = $("input[name='"+name+"']");
        for (var i = 0; i < cbthis.length; i++) {
            if (cbthis[i].value == workdaysArr[j]) {
                cbthis[i].checked = true;
            }
        }
    }
    form.render("checkbox");//重新渲染页面checkbox控件
}


initCheckBox('work_days');

老段
0 声望0 粉丝