?? calendar.htc.html
字號:
'border-bottom-color : #BFBFBF ;'+ 'width : 14% ;'+ 'cursor : hand ;' ) goStyle['DaySelected'] = StyleInfo.rules[StyleInfo.rules.length - 1].style fnLoadCSSDefault('cal--selectedDay-background-color', 'calSelectedDayBackgroundColor', goStyle['DaySelected'], 'backgroundColor') fnLoadCSSDefault('cal--selectedDay-color', 'calSelectedDayColor', goStyle['DaySelected'], 'color') fnLoadCSSDefault('cal--selectedDay-font-family', 'calSelectedDayFontFamily', goStyle['DaySelected'], 'fontFamily') fnLoadCSSDefault('cal--selectedDay-font-size', 'calSelectedDayFontSize', goStyle['DaySelected'], 'fontSize') fnLoadCSSDefault('cal--selectedDay-font-weight', 'calSelectedDayFontWeight', goStyle['DaySelected'], 'fontWeight') fnLoadCSSDefault('cal--selectedDay-text-align', 'calSelectedDayTextAlign', goStyle['DaySelected'], 'textAlign') fnLoadCSSDefault('cal--selectedDay-vertical-align', 'calSelectedDayVerticalAlign', goStyle['DaySelected'], 'verticalAlign')}//------------------------------------------------------------------------//// Function: fnLoadCSSDefault//// Synopsis: This helper function checks to see if a CSS property // extension was used to specify a custom style for the // calendar. If so, the style style object.//// Arguments: sCSSProp The CSS property extension used by the // page author// sScriptProp The scriptable property name to add to the // style Name of the style rule// sStyleRuleProp Name of the CSS property on the style rule//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnLoadCSSDefault(sCSSProp, sScriptProp, oStyleRule, sStyleRuleProp){ if (element.currentStyle[sCSSProp]) { oStyleRule[sStyleRuleProp] = element.currentStyle[sCSSProp] } element.style[sScriptProp] = oStyleRule[sStyleRuleProp] } //------------------------------------------------------------------------//// Function: fnGetPropertyDefaults//// Synopsis: When the for the properties.// If so, error checking is performed and the state of the// calendar is updated.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnGetPropertyDefaults(){ var x var oDate = new Date() giDay = oDate.getDate() giMonth = oDate.getMonth() + 1 giYear = oDate.getYear() // The JavaScript Date.getYear function returns a 2 digit date representation // for dates in the 1900's and a 4 digit date for 2000 and beyond. if (giYear < 100) giYear += 1900 // BUGBUG : Need to fill in day/month/year loading and error checking if (element.year) { if (! isNaN(parseInt(element.year))) giYear = parseInt(element.year) if (giYear < giMinYear) giYear = giMinYear if (giYear > giMaxYear) giYear = giMaxYear } fnCheckLeapYear(giYear) if (element.month) { if (! isNaN(parseInt(element.month))) giMonth = parseInt(element.month) if (giMonth < 1) giMonth = 1 if (giMonth > 12) giMonth = 12 } if (element.day) { if (! isNaN(parseInt(element.day))) giDay = parseInt(element.day) if (giDay < 1) giDay = 1 if (giDay > gaMonthDays[giMonth - 1]) giDay = gaMonthDays[giMonth - 1] } if (element.monthLength) { switch (element.monthLength.toLowerCase()) { case 'short' : giMonthLength = 0 break case 'long' : giMonthLength = 1 break } } if (element.dayLength) { switch (element.dayLength.toLowerCase()) { case 'short' : giDayLength = 0 break case 'medium' : giDayLength = 1 break case 'long' : giDayLength = 1 break } } if (element.firstDay) { if ((element.firstDay >= 0) && (element.firstDay <= 6)) giFirstDay = element.firstDay } if (element.gridCellEffect) { switch (element.gridCellEffect.toLowerCase()) { case 'raised' : giGridCellEffect = 'raised' break case 'flat' : giGridCellEffect = 'flat' break case 'sunken' : giGridCellEffect = 'sunken' break } } if (element.gridLinesColor) gsGridLinesColor = element.gridLinesColor if (element.showDateSelectors) gbShowDateSelectors = (element.showDateSelectors) ? true : false if (element.showDays) gbShowDays = (element.showDays) ? true : false if (element.showTitle) gbShowTitle = (element.showTitle) ? true : false if (element.showHorizontalGrid) gbShowHorizontalGrid = (element.showHorizontalGrid) ? true : false if (element.showVerticalGrid) gbShowVerticalGrid = (element.showVerticalGrid) ? true : false if (element.valueIsNull) gbValueIsNull = (element.valueIsNull) ? true : false if (element.name) gsName = element.name if (element.readOnly) gbReadOnly = (element.readOnly) ? true : false}// **********************************************************************// CALENDAR CONTROL FUNCTIONS// **********************************************************************//------------------------------------------------------------------------//// Function: fnSetDate//// Synopsis: The fnSetDate function is used internally to set the day,// month, and year values. //// Arguments: iDay The new day// iMonth The new month // iYear The new year//// Returns: none//// Notes: It does some error checking and some minor performance // optimizations if the month & year are not being changed.////------------------------------------------------------------------------function fnSetDate(iDay, iMonth, iYear){ var bValueChange = false if (gbValueIsNull) { gbValueIsNull = false fnFireOnPropertyChange("propertyName", "valueIsNull") } if (iYear < giMinYear) iYear = giMinYear if (iYear > giMaxYear) iYear = giMaxYear if (giYear != iYear) { fnCheckLeapYear(iYear) } if (iMonth < 1) iMonth = 1 if (iMonth > 12) iMonth = 12 if (iDay < 1) iDay = 1 if (iDay > gaMonthDays[giMonth - 1]) iDay = gaMonthDays[giMonth - 1] if ((giDay == iDay) && (giMonth == iMonth) && (giYear == iYear)) return else bValueChange = true if (giDay != iDay) { giDay = iDay fnFireOnPropertyChange("propertyName", "day") } if ((giYear == iYear) && (giMonth == iMonth)) { goCurrentDayCell.className = 'Day_' + uniqueID goCurrentDayCell = gaDayCell[giStartDayIndex + iDay - 1] goCurrentDayCell.className = 'DaySelected_' + uniqueID giDay = iDay } else { if (giYear != iYear) { giYear = iYear fnFireOnPropertyChange("propertyName", "year") fnUpdateYearSelect() } if (giMonth != iMonth) { giMonth = iMonth fnFireOnPropertyChange("propertyName", "month") fnUpdateMonthSelect() } fnUpdateTitle() fnFillInCells() } if (bValueChange) fnFireOnPropertyChange("propertyName", "value")}//------------------------------------------------------------------------//// Function: fnUpdateTitle//// Synopsis: This function updates the title with the currently selected// month and year. The month is displayed in the format// specified by the monthLength option//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnUpdateTitle(){ var oTitleCell = element.children[0].rows[0].cells[0] if (gbShowTitle) oTitleCell.innerHTML = gaMonthNames[giMonthLength][giMonth - 1] + " " + giYear else oTitleCell.innerText = ' '}//------------------------------------------------------------------------//// Function: fnUpdateDayTitles//// Synopsis: This function updates the titles for the days of the week.// They are displayed in the format specified by the dayLength // option beginning with the day of the week specified by the// firstDay option.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnUpdateDayTitles(){ var dayTitleRow = element.children[0].rows[1].cells[0].children[0].rows[0] var iCell = 0 for (i=giFirstDay ; i < 7 ; i++) { goDayTitleRow.cells[iCell++].innerText = gaDayNames[giDayLength][i] } for (i=0; i < giFirstDay; i++) { goDayTitleRow.cells[iCell++].innerText = gaDayNames[giDayLength][i] }}//------------------------------------------------------------------------//// Function: fnUpdateMonthSelect//// Synopsis: When the month changes, this function is called to select// the correct month in the month select control.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnUpdateMonthSelect(){ goMonthSelect.options[ giMonth - 1 ].selected = true}//------------------------------------------------------------------------//// Function: fnBuildMonthSelect//// Synopsis: When the calendar is created, this function inserts the // month values into the select control and selects the // current month.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnBuildMonthSelect(){ var newMonthSelect newMonthSelect = element.document.createElement("SELECT") goMonthSelect.parentElement.replaceChild(newMonthSelect, goMonthSelect) goMonthSelect = newMonthSelect for (i=0 ; i < 12; i++) { e = element.document.createElement("OPTION") e.text = gaMonthNames[giMonthLength][i] goMonthSelect.options.add(e) } goMonthSelect.options[ giMonth - 1 ].selected = true goMonthSelect.attachEvent("onchange", fnMonthSelectOnChange)}//------------------------------------------------------------------------//// Function: fnMonthSelectOnChange//// Synopsis: When the user changes the month using the month select // control, this function handles the onSelectChange event// to update the date.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnMonthSelectOnChange(){ iMonth = goMonthSelect.selectedIndex + 1 fnSetDate(giDay, iMonth, giYear)}//------------------------------------------------------------------------//// Function: fnUpdateYearSelect//// Synopsis: When the year changes, this function is called to select// the correct year in the year select control.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnUpdateYearSelect(){ goYearSelect.options[ giYear - giMinYear ].selected = true}//------------------------------------------------------------------------//// Function: fnBuildYearSelect//// Synopsis: When the calendar is created, this function inserts the // year values into the select control and selects the // current year.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnBuildYearSelect(){ var newYearSelect newYearSelect = element.document.createElement("SELECT") goYearSelect.parentElement.replaceChild(newYearSelect, goYearSelect) goYearSelect = newYearSelect for (i=giMinYear; i <= giMaxYear; i++) { e = element.document.createElement("OPTION") e.text = i goYearSelect.options.add(e) } goYearSelect.options[ giYear - giMinYear ].selected = true goYearSelect.attachEvent("onchange", fnYearSelectOnChange)}//------------------------------------------------------------------------//// Function: fnYearSelectOnChange//
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -