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("