?? calendar.htc.html
字號:
// Synopsis: When the user changes the year using the year select // control, this function handles the onSelectChange event// to update the date.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnYearSelectOnChange(){ iYear = goYearSelect.selectedIndex + giMinYear fnSetDate(giDay, giMonth, iYear)}//------------------------------------------------------------------------//// Function: fnCheckLeapYear//// Synopsis: When the year changes, this function must be called to // ensure that February has the correct count for the number// of days.//// Arguments: year//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnCheckLeapYear(iYear){ gaMonthDays[1] = (((!(iYear % 4)) && (iYear % 100) ) || !(iYear % 400)) ? 29 : 28}//------------------------------------------------------------------------//// Function: fnFillInCells//// Synopsis: This method works through the table and sets the day and// style needed.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnFillInCells(){ var iDayCell = 0 var iLastMonthIndex, iNextMonthIndex var iLastMonthTotalDays var iStartDay fnCheckLeapYear(giYear) iLastMonthDays = gaMonthDays[ ((giMonth - 1 == 0) ? 12 : giMonth - 1) - 1] iNextMonthDays = gaMonthDays[ ((giMonth + 1 == 13) ? 1 : giMonth + 1) - 1] iLastMonthYear = (giMonth == 1) ? giYear - 1 : giYear iLastMonth = (giMonth == 1) ? 12 : giMonth - 1 iNextMonthYear = (giMonth == 12) ? giYear + 1 : giYear iNextMonth = (giMonth == 12) ? 1 : giMonth + 1 var oDate = new Date(giYear, (giMonth - 1), 1) iStartDay = oDate.getDay() - giFirstDay if (iStartDay < 1) iStartDay += 7 iStartDay = iLastMonthDays - iStartDay + 1 for (i = iStartDay ; i <= iLastMonthDays ; i++ , iDayCell++) { gaDayCell[iDayCell].innerText = i if (gaDayCell[iDayCell].className != 'OffDay_' + uniqueID) gaDayCell[iDayCell].className = 'OffDay_' + uniqueID gaDayCell[iDayCell].day = i gaDayCell[iDayCell].month = iLastMonth gaDayCell[iDayCell].year = iLastMonthYear } giStartDayIndex = iDayCell for (i = 1 ; i <= gaMonthDays[giMonth - 1] ; i++, iDayCell++) { gaDayCell[iDayCell].innerText = i if (giDay == i) { goCurrentDayCell = gaDayCell[iDayCell] gaDayCell[iDayCell].className = 'DaySelected_' + uniqueID } else { if (gaDayCell[iDayCell].className != 'Day_' + uniqueID) gaDayCell[iDayCell].className = 'Day_' + uniqueID } gaDayCell[iDayCell].day = i gaDayCell[iDayCell].month = giMonth gaDayCell[iDayCell].year = giYear } for (i = 1 ; iDayCell < 42 ; i++, iDayCell++) { gaDayCell[iDayCell].innerText = i if (gaDayCell[iDayCell].className != 'OffDay_' + uniqueID) gaDayCell[iDayCell].className = 'OffDay_' + uniqueID gaDayCell[iDayCell].day = i gaDayCell[iDayCell].month = iNextMonth gaDayCell[iDayCell].year = iNextMonthYear }}// **********************************************************************// EVENT HANDLERS// **********************************************************************//------------------------------------------------------------------------//// Function: fnOnClick//// Synopsis: When the user clicks on the calendar, change the date if// needed//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnOnClick(){ var e = window.event.srcElement if (e.tagName == "TD") { if (gbReadOnly || (!e.day)) return // The calendar is read only if ((e.year < giMinYear) || (e.year > giMaxYear)) return fnSetDate(e.day, e.month, e.year) }}//------------------------------------------------------------------------//// Function: fnOnSelectStart//// Synopsis: This cancels selection when the user clicks and drags the // mouse on the calendar. It can still be selected if the// the SelectStart begins outside this element.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnOnSelectStart(){ window.event.returnValue = false window.event.cancelBubble = true}//------------------------------------------------------------------------//// Function: fnOnReadyStateChange//// Synopsis: When the behavior is completely loaded, set the global // loading flag to false.//// Arguments: none//// Returns: none//// Notes: To improve load time, we do not want the put methods on // properties to be called. We also need to keep events from// getting fired while the behavior is loading.////------------------------------------------------------------------------function fnOnReadyStateChange(){ gbLoading = (readyState != "complete")}//------------------------------------------------------------------------//// Function: fnOnPropertyChange//// Synopsis: When a property changes on the element, this function will// check it to see if part of the calendar needs to be changed// as a result. //// Arguments: none//// Returns: none//// Notes: This is currently only checking extended style// properties to alter the calendar style sheet rules.////------------------------------------------------------------------------function fnOnPropertyChange(){ if (window.event.propertyName.substring(0, 5) == 'style') { switch (window.event.propertyName) { case 'style.calTitleBackgroundColor' : goStyle['WholeCalendar'].backgroundColor = style.calTitleBackgroundColor goStyle['Title'].backgroundColor = style.calTitleBackgroundColor break case 'style.calTitleColor' : goStyle['Title'].color = style.calTitleColor break case 'style.calTitleFontFamily' : goStyle['Title'].fontFamily = style.calTitleFontFamily break case 'style.calTitleFontSize' : goStyle['Title'].fontSize = style.calTitleFontSize break case 'style.calTitleFontWeight' : goStyle['Title'].fontWeight = style.calTitleFontWeight break case 'style.calTitleTextAlign' : goStyle['Title'].textAlign = style.calTitleTextAlign break case 'style.calDayTitleBackgroundColor' : goStyle['DayTitle'].backgroundColor = style.calDayTitleBackgroundColor break case 'style.calDayTitleColor' : goStyle['DayTitle'].color = style.calDayTitleColor break case 'style.calDayTitleFontFamily' : goStyle['DayTitle'].fontFamily = style.calDayTitleFontFamily break case 'style.calDayTitleFontSize' : goStyle['DayTitle'].fontSize = style.calDayTitleFontSize break case 'style.calDayTitleFontWeight' : goStyle['DayTitle'].fontWeight = style.calDayTitleFontWeight break case 'style.calDayTitleTextAlign' : goStyle['DayTitle'].textAlign = style.calDayTitleTextAlign break case 'style.calOffMonthBackgroundColor' : goStyle['OffDay'].backgroundColor = style.calOffMonthBackgroundColor break case 'style.calOffMonthColor' : goStyle['OffDay'].color = style.calOffMonthColor break case 'style.calOffMonthFontFamily' : goStyle['OffDay'].fontFamily = style.calOffMonthFontFamily break case 'style.calOffMonthFontSize' : goStyle['OffDay'].fontSize = style.calOffMonthFontSize break case 'style.calOffMonthFontWeight' : goStyle['OffDay'].fontWeight = style.calOffMonthFontWeight break case 'style.calOffMonthTextAlign' : goStyle['OffDay'].textAlign = style.calOffMonthTextAlign break case 'style.calOffMonthVerticalAlign' : goStyle['OffDay'].verticalAlign = style.calOffMonthVerticalAlign break case 'style.calCurrentMonthBackgroundColor' : goStyle['Day'].backgroundColor = style.calCurrentMonthBackgroundColor break case 'style.calCurrentMonthColor' : goStyle['Day'].color = style.calCurrentMonthColor break case 'style.calCurrentMonthFontFamily' : goStyle['Day'].fontFamily = style.calCurrentMonthFontFamily break case 'style.calCurrentMonthFontSize' : goStyle['Day'].fontSize = style.calCurrentMonthFontSize break case 'style.calCurrentMonthFontWeight' : goStyle['Day'].fontWeight = style.calCurrentMonthFontWeight break case 'style.calCurrentMonthTextAlign' : goStyle['Day'].textAlign = style.calCurrentMonthTextAlign break case 'style.calCurrentMonthVerticalAlign' : goStyle['Day'].verticalAlign = style.calCurrentMonthVerticalAlign break case 'style.calSelectedDayBackgroundColor' : goStyle['DaySelected'].backgroundColor = style.calSelectedDayBackgroundColor break case 'style.calSelectedDayColor' : goStyle['DaySelected'].color = style.calSelectedDayColor break case 'style.calSelectedDayFontFamily' : goStyle['DaySelected'].fontFamily = style.calSelectedDayFontFamily break case 'style.calSelectedDayFontSize' : goStyle['DaySelected'].fontSize = style.calSelectedDayFontSize break case 'style.calSelectedDayFontWeight' : goStyle['DaySelected'].fontWeight = style.calSelectedDayFontWeight break case 'style.calSelectedDayTextAlign' : goStyle['DaySelected'].textAlign = style.calSelectedDayTextAlign break case 'style.calSelectedDayVerticalAlign' : goStyle['DaySelected'].verticalAlign = style.calSelectedDayVerticalAlign break } }}// **********************************************************************// HELPER FUNCTIONS// **********************************************************************//------------------------------------------------------------------------//// Function: fnFireOnPropertyChange//// Synopsis: //// Arguments: //// Returns: //// Notes: ////------------------------------------------------------------------------function fnFireOnPropertyChange(name1, value1){ var evObj = createEventObject() evObj.setAttribute(name1, value1) onPropertyChange.fire(evObj)}//------------------------------------------------------------------------//// Function: fnUpdateGridColors//// Synopsis: This is a helper function for the calendar grid rendering// properties. It handles setting the style rules to create// the desired effects.// // Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnUpdateGridColors(){ switch (gsGridCellEffect) { case "raised" : goStyle['OffDay'].borderLeftColor = 'white' goStyle['OffDay'].borderTopColor = 'white' goStyle['OffDay'].borderRightColor = 'black' goStyle['OffDay'].borderBottomColor = 'black' goStyle['Day'].borderLeftColor = 'white' goStyle['Day'].borderTopColor = 'white' goStyle['Day'].borderRightColor = 'black' goStyle['Day'].borderBottomColor = 'black' goStyle['DaySelected'].borderLeftColor = 'white' goStyle['DaySelected'].borderTopColor = 'white' goStyle['DaySelected'].borderRightColor = 'black' goStyle['DaySelected'].borderBottomColor = 'black' break case "flat" : goStyle['OffDay'].borderLeftColor = goStyle['OffDay'].backgroundColor goStyle['OffDay'].borderTopColor = goStyle['OffDay'].backgroundColor goStyle['OffDay'].borderRightColor = (gbShowVerticalGrid) ? gsGridLinesColor : goStyle['Day'].backgroundColor goStyle['OffDay'].borderBottomColor = (gbShowHorizontalGrid) ? gsGridLinesColor : goStyle['Day'].backgroundColor goStyle['Day'].borderLeftColor = goStyle['Day'].backgroundColor goStyle['Day'].borderTopColor = goStyle['Day'].backgroundColor goStyle['Day'].borderRightColor = (gbShowVerticalGrid) ? gsGridLinesColor : goStyle['Day'].backgroundColor goStyle['Day'].borderBottomColor = (gbShowHorizontalGrid) ? gsGridLinesColor : goStyle['Day'].backgroundColor goStyle['DaySelected'].borderLeftColor = goStyle['DaySelected'].backgroundColor goStyle['DaySelected'].borderTopColor = goStyle['DaySelected'].backgroundColor goStyle['DaySelected'].borderRightColor = (gbShowVerticalGrid) ? gsGridLinesColor : goStyle['Day'].backgroundColor goStyle['DaySelected'].borderBottomColor = (gbShowHorizontalGrid) ? gsGridLinesColor : goStyle['Day'].backgroundColor break case "sunken" : goStyle['OffDay'].borderLeftColor = 'black' goStyle['OffDay'].borderTopColor = 'black' goStyle['OffDay'].borderRightColor = 'white' goStyle['OffDay'].borderBottomColor = 'white' goStyle['Day'].borderLeftColor = 'black' goStyle['Day'].borderTopColor = 'black' goStyle['Day'].borderRightColor = 'white' goStyle['Day'].borderBottomColor = 'white' goStyle['DaySelected'].borderLeftColor = 'black' goStyle['DaySelected'].borderTopColor = 'black' goStyle['DaySelected'].borderRightColor = 'white' goStyle['DaySelected'].borderBottomColor = 'white' break default : throw 450 }}</script><public:property put=fnPutDay get=fnGetDay name="day"><public:property put=fnPutMonth get=fnGetMonth name="month"><public:property put=fnPutYear get=fnGetYear name="year"><public:property put=fnPutMonthLength get=fnGetMonthLength name="monthLength"><public:property put=fnPutDayLength get=fnGetDayLength name="dayLength"><public:property put=fnPutFirstDay get=fnGetFirstDay name="firstDay"><public:property put=fnPutGridCellEffect get=fnGetGridCellEffect name="gridCellEffect"><public:property put=fnPutGridLinesColor get=fnGetGridLinesColor name="gridLinesColor"><public:property put=fnPutShowDateSelectors get=fnGetShowDateSelectors name="showDateSelectors"><public:property put=fnPutShowDays get=fnGetShowDays name="showDays"><public:property put=fnPutShowTitle get=fnGetShowTitle name="showTitle"><public:property put=fnPutShowVerticalGrid get=fnGetShowVerticalGrid name="showVerticalGrid"><public:property put=fnPutShowHorizontalGrid get=fnGetShowHorizontalGrid name="showHorizontalGrid"><public:property put=fnPutValue get=fnGetValue name="value"><public:property put=fnPutValueIsNull get=fnGetValueIsNull name="valueIsNull"><public:property put=fnPutReadOnly get=fnGetReadOnly name="readOnly"><public:event id="onChange" name="onchange"><public:event id="onPropertyChange" name="onpropertychange"><public:event id="onError" name="onerror">
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -