日期:2014-05-16 浏览次数:20373 次
var listBox = {};
listBox.chickChkBox = function(chk){
chk = $(chk);
if(chk.attr("checked")){
chk.parents("tr").find("td").addClass("choose");
chk.parents("td").attr("class","chk_on");
}else{
chk.parents("tr").find("td").removeClass("choose");
chk.parents("td").attr("class","chk_off");
}
}
listBox.choose = function(){
var courseId = $("#courseId").val();
if(courseId==""){
alert("参数缺失.");
return;
}
var chks = $(".courseId:checked");
if(chks.length<1){
alert("请选择要挂接的培训班.");
return;
}
var str = "";
for(var i = 0; i < chks.length; i++){
str += "refCourseId="+$(chks.get(i)).val()+"&";
}
str += "formMap.COURSE_ID="+courseId;
$.ajax({
cache:false,
type:'POST',
dataType:'text',
url:'/course/cmscoursereferrer/addCourseRefAjax.do',
data:str,
success:function(rst){
rst = new Function("return " + rst)();
if(rst.status){
alert("绑定成功.");
window.close();
}else{
alert("绑定失败.");
}
}
});
}
<button type="button" onclick="listBox.choose();">绑定选择的课程</button>