//日期控制函数 function AirChinaCalendar (sName, sDate) { ///////////////////////////////////////////////////////////////////////// //定义UncCalendar对象的属性并赋默认值。 //inputValue属性的值为"today"时表示(客户机)当前日期。 //直接在这里把默认值修改成你想要的,使用时你就什么也不用设置了。 this.inputName = sName || "uncDate"; this.inputValue = sDate || ""; this.inputSize = 10; this.inputClass = ""; this.color = "#000080"; this.bgColor = "#EEEEFF"; this.buttonWidth = 10; this.buttonWords = "选择日期"; this.canEdits = false; this.hidesSelects = false; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// //定义display方法。 this.display = function () { var reDate = /^(19[7-9]\d|20[0-5]\d)\-(0?\d|1[0-2])\-([0-2]?\d|3[01])$/; if (reDate.test(this.inputValue)) { var dates = this.inputValue.split("-"); var year = parseInt(dates[0], 10); var month = parseInt(dates[1], 10); var mday = parseInt(dates[2], 10); } else { var today = new Date(); var year = today.getFullYear(); var month = today.getMonth()+1; var mday = today.getDate(); } if (this.inputValue == "today") inputValue = year + "-" + month + "-" + mday; else inputValue = this.inputValue; var lastDay = new Date(year, month, 0); lastDay = lastDay.getDate(); var firstDay = new Date(year, month-1, 1); firstDay = firstDay.getDay(); var btnBorder = "border-left:1px solid #FFFFFF;" + "border-right:1px solid #FFFFFF;" + "border-top:1px solid #FFFFFF;" + "border-bottom:1px solid #FFFFFF;"; var btnStyle = "padding-top:3px;cursor:default;width:" + this.buttonWidth + "px;text-align:center;height:15px;top:-13px;" + "font:normal 12px 宋体;position:absolute;z-index:99;" + "line-height:12px;" + btnBorder + "color:#FFFFFF;"; var boardStyle = "position:absolute;width:1px;height:1px;background:" + this.bgColor + ";top:8px;border:1px solid "+ this.color + ";display:none;padding:3px;"; var buttonEvent = " onmouseover=\"this.childNodes[0].style.borderBottom='0px';" + "this.childNodes[1].style.display='';this.style.zIndex=100;" + (this.hidesSelects ? "var slts=document.getElementsByTagName('SELECT');" + "for(var i=0;i"; output += " "; output += "
"; output += "
" + this.buttonWords + "
"; output += "
"; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; output += " "; var day = 1; for (var row=0; row<6; row++) { output += ""; for (var col=0; col<7; col++) { if (row == 0 && col < firstDay) output += ""; else if (day <= lastDay) { output += ""; day++; } else output += ""; } output += ""; } output += "
<<<"; output += " " + year + "" + month + ""; output += " >>>
 " + day + "
"; output += "
"; output += "
"; output += " "; output += ""; document.write(output); } ///////////////////////////////////////////////////////////////////////// } /****** 控制日期table函数 *******/ function checkDate_Ffp(){ var flightTypeArray = document.getElementsByName("flightType"); var flightTypeValue = ""; for(var i = 0 ; i < flightTypeArray.length ; i++){ if(flightTypeArray[i].checked == true){ flightTypeValue = flightTypeArray[i].value; break; } } var dateTableObj = document.getElementById("dateTable"); if(flightTypeValue == "single"){ document.getElementById("BACK").style.visibility = "hidden"; document.getElementById("backTime").style.visibility = "hidden"; document.getElementById("backButton").style.visibility = "hidden"; document.getElementById("backButton").disabled = true; } else if(flightTypeValue == "return"){ document.getElementById("BACK").style.visibility = "visible"; document.getElementById("backTime").style.visibility = "visible"; document.getElementById("backButton").style.visibility = "visible"; document.getElementById("backButton").disabled = false; } } function checkQueryForm_Ffp(){ var flightTypeArray = document.getElementsByName("flightType"); var flightTypeValue = ""; for(var i = 0 ; i < flightTypeArray.length ; i++){ if(flightTypeArray[i].checked == true){ flightTypeValue = flightTypeArray[i].value; break; } } if(flightTypeValue == "return"){ var depDateArray = document.queryForm.forwardTime.value.split("-"); var depyear = parseInt(depDateArray[0], 10); var depmonth = parseInt(depDateArray[1], 10); var depday = parseInt(depDateArray[2], 10); var depDate = new Date(depyear,depmonth - 1 ,depday); var backDateArray = document.queryForm.backTime.value.split("-"); var backyear = parseInt(backDateArray[0], 10); var backmonth = parseInt(backDateArray[1], 10); var backday = parseInt(backDateArray[2], 10); var backDate = new Date(backyear,backmonth - 1 ,backday); if(depDate.getTime() > backDate.getTime()){ alert("去程时间不能在回程时间之后!"); return; } } document.queryForm.action = "/ffpquery/load.jsp"; document.queryForm.submit(); }