function checkDate1(count) { var start; var end; var num=0; var str1; var str2; var str3; for(i=0;i<count;i++) { str1="uc"+i+"_txtBegin"; str2="uc"+i+"_txtEnd"; str3="uc"+i+"_divMess"; start=document.getElementById(str1).value; end=document.getElementById(str2).value; if(start=="" || end==""|| start==null || end==null) { document.getElementById(str3).innerHTML="<font color='red'>时间设置不能为空</font>"; num++; } else { var bool=compareDate(start,end); if(bool) { document.getElementById(str3).innerHTML="<font color='red'>开始时间不能大于结束时间</font>"; num++; } else document.getElementById(str3).innerHTML=""; } } if(num!=0) return false; else return true; } function checkAll(count) { if(checkTeamTime()) return true; else return false; } //日期时间的比较 function compareDate(startDate,endDate) { var startMonth = startDate.substring(5,startDate.lastIndexOf ("-")); var startDay = startDate.substring(startDate.length,startDate.lastIndexOf ("-")+1); var startYear = startDate.substring(0,startDate.indexOf ("-")); var endMonth = endDate.substring(5,endDate.lastIndexOf ("-")); var endDay = endDate.substring(endDate.length,endDate.lastIndexOf ("-")+1); var endYear = endDate.substring(0,endDate.indexOf ("-")); if (Date.parse(startMonth+"/"+startDay+"/"+startYear) > Date.parse(endMonth+"/"+endDay+"/"+endYear)) { return true; } return false; } function checkAllText(count){ for(var i=1;i<=count;i++) { var txtBegin=document.getElementById("uc"+i+"_txtBegin").value; var txtEnd=document.getElementById("uc"+i+"_txtEnd").value; if(txtBegin==""||txtEnd=="") { alert("补课/调课时间请填写完整!"); return false; } else if(txtBegin==txtEnd) { alert("补课/调课时间不能设置一样,请确认!"); return false; } } }