function CurrentDate() { today = new Date(); var date; date = (today.getYear())+ "/"+ (today.getMonth() + 1 ) + "/" +(today.getDate()); return date; } var strDateBegin = "1999/8/5"; var strDateEnd = CurrentDate() var href = "stwb/?/GB/default.htm"; var strAlert = "\n查阅日期范围:\n\n" + strDateBegin + "至" + strDateEnd; var strMonth = "一月份二月份三月份四月份五月份六月份七月份八月份九月份十月份十一月十二月"; var strWeek = "日一二三四五六"; var strYear = "年"; var dateBegin = new Date(strDateBegin) var dateEnd = new Date(strDateEnd) var nYearBegin = dateBegin.getYear() var nMonthBegin = dateBegin.getMonth() var nDateBegin = dateBegin.getDate() var nYearEnd = dateEnd.getYear() var nMonthEnd = dateEnd.getMonth() var nDateEnd = dateEnd.getDate() var nMonthIndex//, nYearIndex var nYearSel, nMonthSel if (nYearBegin <= 100) nYearBegin += 1900 if (nYearEnd <= 100) nYearEnd += 1900 //xlz 1999-5-5 function updateWeekDisplay(formObj) { var monthObj = formObj.monthSelection var yearObj = formObj.yearSelection var month = monthObj.selectedIndex var year = yearObj.options[yearObj.selectedIndex].text.substring(0, 4) var strDateLimit if ((year == nYearBegin && month < nMonthBegin) || (year == nYearEnd && month > nMonthEnd)) { alert(strAlert) // yearObj.selectedIndex = nYearIndex monthObj.selectedIndex = nMonthIndex return } else if (year == nYearBegin && month == nMonthBegin) strDateLimit = "begin" else if (year == nYearEnd && month == nMonthEnd) strDateLimit = "end" else strDateLimit = "no" if (nYearBegin == nYearEnd && nMonthBegin == nMonthEnd) strDateLimit = "both" // nYearIndex = yearObj.selectedIndex nMonthIndex = month month++ nYearSel = year nMonthSel = month if (month == 2) { if ((year%100 == 0 && year%400 == 0) || (year%100 != 0 && year%4 == 0)) nDays = 29 else nDays = 28 } else if ((month < 8 && month%2 == 1) || (month >= 8 && month%2 == 0)) nDays = 31 else nDays = 30 var nDay = (new Date(year, month - 1, "1")).getDay() var array = formObj.elements var index = 2, nDate = 1 var i, j, str for (i = 0; i < 6; i++) { for (j = 0; j < 7; j++, index++) { if (j == nDay && nDate <= nDays) { str = nDate if (nDate < 10) str = " " + nDate if (strDateLimit == "no" || (strDateLimit == "begin" && nDate >= nDateBegin) || (strDateLimit == "end" && nDate <= nDateEnd) || (strDateLimit == "both" && nDate >= nDateBegin && nDate <= nDateEnd)) { array[index].value = str } else array[index].value = "--" nDate++ nDay++ } else array[index].value = "--" } nDay = 0 } } /* function updateWeekDisplay(monthObj, yearObj, act) { var month = monthObj.selectedIndex var year = yearObj.options[yearObj.selectedIndex].text.substring(0, 4) var strDateLimit if ((year == nYearBegin && month < nMonthBegin) || (year == nYearEnd && month > nMonthEnd)) { alert(strAlert) // yearObj.selectedIndex = nYearIndex monthObj.selectedIndex = nMonthIndex return } else if (year == nYearBegin && month == nMonthBegin) strDateLimit = "begin" else if (year == nYearEnd && month == nMonthEnd) strDateLimit = "end" else strDateLimit = "no" if (nYearBegin == nYearEnd && nMonthBegin == nMonthEnd) strDateLimit = "both" // nYearIndex = yearObj.selectedIndex nMonthIndex = month month++ nYearSel = year nMonthSel = month if (month == 2) { if ((year%100 == 0 && year%400 == 0) || (year%100 != 0 && year%4 == 0)) nDays = 29 else nDays = 28 } else if ((month < 8 && month%2 == 1) || (month >= 8 && month%2 == 0)) nDays = 31 else nDays = 30 var nDay = (new Date(year, month - 1, "1")).getDay() var nDays, i, j, str for (i = 1; i <= nDays;) { document.write("") for (j = 0; j < 7; j++) { if ((j == nDay && i <= nDays)) { if (i < 10) str = " " + i else str = i if (strDateLimit == "no" || (strDateLimit == "begin" && i >= nDateBegin) || (strDateLimit == "end" && i <= nDateEnd) || (strDateLimit == "both" && i >= nDateBegin && i <= nDateEnd)) { document.write("") } else document.write("") i++ nDay++ } else document.write("") } document.write("") nDay = 0 } if (act == "back" || act == "patch") history.back() } */ function updateUrl(nDate) { // var dateSel = new Date(nYearSel, nMonthSel - 1, nDate) // var nTimeSel = dateSel.getTime() // if (nTimeSel >= dateBegin.getTime() && nTimeSel <= dateEnd.getTime()) // { var nDateSel = nDate if (nDate.indexOf(" ") == 0) { nDateSel = nDate.substring(1, 2) } var nIndex = href.indexOf("?") var newhref = href.substring(0, nIndex) newhref.toLowerCase() if (newhref.indexOf(".asp") > -1 && href.indexOf("&") > -1) newhref = href + nYearSel + "/" + nMonthSel + "/" + nDateSel else { var temp = window.locations.href.toLowerCase() var temp1 = href.substring(0, nIndex) var nIndex1 newhref = temp1 nIndex1 = temp.indexOf(temp1.toLowerCase()) if (nIndex1 >= 0) { newhref = temp.substring(0, nIndex1) + newhref } newhref += nYearSel if (nMonthSel < 10) newhref += "0" + nMonthSel else newhref += nMonthSel if (nDateSel < 10) newhref += "0" + nDateSel else newhref += nDateSel newhref += href.substring(nIndex + 1) } window.open(newhref, "ReviewWin") // } return false }