DWR回调函数和生成下拉列表
/**
* DWR 测试会议室
*/
function checkMeetingRoom(){
var starttime = meetingForm.startdate.value;
var endtime = meetingForm.enddate.value;
var meetingRoom = meetingForm.meetingRoomName.value;
if(starttime != "" && endtime != ""){
MeetingDWR.checkMeetingRoom (starttime,endtime,callMeetingRoom);
}
}
function callMeetingRoom(result) {
objNew=document.getElementById("meetingRoomCheck");
if(result.length == 0){
objNew.innerHTML = "没有可用会议室,请重新安排时间!";
clearOption();
var objTotal = document.meetingForm.meetingRoomName;
var optionTotal = new Option('--不可选--', "-1");
objTotal.options.add(optionTotal);
return false;
}
else{
clearOption();
objNew.innerHTML = "";
var objFirst = document.meetingForm.meetingRoomName;
var optionFirst = new Option('--请选择--', "-1");
objFirst.options.add(optionFirst);
for(var i = 0; i<result.length; i++) {
var obj = document.meetingForm.meetingRoomName;
var option = new Option(result[i], result[i]);
obj.options[i+1] = option;
}
}
}
//清空下拉列表
function clearOption(){
var obj = document.meetingForm.meetingRoomName;
var len = obj.options.length;
for(var i = 0; i < len; i++) {
obj.options[0] = null;
}
}