📄 calendar.htc.html
字号:
// Synopsis: The showHorizontalGrid property is used to toggle the // visibility of horizontal lines in the calendar grid.// // Arguments: The put method requires true or false value for visibility//// Returns: The get method will return a true or false value//// Notes: none////------------------------------------------------------------------------function fnGetShowHorizontalGrid(){ return gbShowHorizontalGrid}function fnPutShowHorizontalGrid(bShowHorizontalGrid){ if (gbLoading) return // return if the behavior is loading if ((bShowHorizontalGrid) != gbShowHorizontalGrid) { gbShowHorizontalGrid = (bShowHorizontalGrid) ? true : false fnFireOnPropertyChange("propertyName", "showHorizontalGrid") fnUpdateGridColors() }}//------------------------------------------------------------------------//// Function: fnGetShowDateSelectors / fnPutShowDateSelectors//// Synopsis: The showDateSelectors property toggles the visibility of// the month and year select controls.// // Arguments: The put method requires true or false value for visibility//// Returns: The get method will return a true or false value//// Notes: none////------------------------------------------------------------------------function fnGetShowDateSelectors(){ return gbShowDateSelectors}function fnPutShowDateSelectors(bShowDateSelectors){ if (gbLoading) return // return if the behavior is loading gbShowDateSelectors = (bShowDateSelectors) ? true : false element.children[0].rows[0].cells[1].style.display = (gbShowDateSelectors) ? '' : 'none' element.children[0].rows[0].style.display = (gbShowDateSelectors || gbShowTitle) ? '' : 'none'}//------------------------------------------------------------------------//// Function: fnGetShowDays / fnPutShowDays//// Synopsis: The showDays property toggles the visibility of// the day of the week titles row in the calendar grid.// // Arguments: The put method requires true or false value for visibility//// Returns: The get method will return a true or false value//// Notes: none////------------------------------------------------------------------------function fnGetShowDays(){ return gbShowDays}function fnPutShowDays(bShowDays){ if (gbLoading) return // return if the behavior is loading gbShowDays = (bShowDays) ? true : false goDayTitleRow.style.display = (gbShowDays) ? '' : 'none'}//------------------------------------------------------------------------//// Function: fnGetShowTitle / fnPutShowTitle//// Synopsis: the showTitle property toggles the visibility of the month// and year title at the top of the calendar.// // Arguments: The put method requires true or false value for visibility//// Returns: The get method will return a true or false value//// Notes: none////------------------------------------------------------------------------function fnGetShowTitle(){ return gbShowTitle}function fnPutShowTitle(bShowTitle){ if (gbLoading) return // return if the behavior is loading gbShowTitle = (bShowTitle) ? true : false element.children[0].rows[0].style.display = (gbShowDateSelectors || gbShowTitle) ? '' : 'none' fnUpdateTitle()}//------------------------------------------------------------------------//// Function: fnGetValue / fnPutValue//// Synopsis: The value property returns the day, month, and year in the// format: {day}/{month}/{year}// example: 25/02/1998// An invalid value will cause an exception.// // Arguments: The put method requires a string in the format described // above//// Returns: The get method will return the current date value//// Notes: The day and month are returned in the two digit format.// The year is returned in a four digit format.////------------------------------------------------------------------------function fnGetValue(){ var sValue if (gbValueIsNull) return null sValue = ((giDay < 10) ? '0' + giDay : giDay) + '/' + ((giMonth < 10) ? '0' + giMonth : giMonth) + '/' if (giYear < 10) return sValue + '000' + giYear if (giYear < 100) return sValue + '00' + giYear if (giYear < 1000) return sValue + '0' + giYear return sValue + giYear}function fnPutValue(sValue){ if (gbLoading) return // return if the behavior is loading var aValue = sValue.split('/') // ensure valid valuse for month, day, and year aValue[0]++ ; aValue[0]-- ; aValue[1]++ ; aValue[1]-- ; aValue[2]++ ; aValue[2]-- ; if ( isNaN(aValue[0]) || isNaN(aValue[1]) || isNaN(aValue[2]) ) throw 450 fnSetDate(aValue[0], aValue[1], aValue[2])}//------------------------------------------------------------------------//// Function: fnGetValueIsNull / fnPutValueIsNull//// Synopsis: The valueIsNull property set the calendar so that no day// is selected. Changing any date property, setting one of // the date select controls, or clicking on a day will result // in the valueIsNull property getting set to false.// // Arguments: The put method requires a string in the format described // above//// Returns: The get method will return the current date value//// Notes: The day and month are returned in the two digit format.// The year is returned in a four digit format.////------------------------------------------------------------------------function fnGetValueIsNull() { return gbValueIsNull }function fnPutValueIsNull(bValueIsNull){ if (gbLoading) return // return if the behavior is loading if ((bValueIsNull) != gbValueIsNull) { gbValueIsNull = (bValueIsNull) ? true : false fnFireOnPropertyChange("propertyName", "readOnly") } goCurrentDayCell.className = (bValueIsNull) ? 'Day_' + uniqueID : 'DaySelected_' + uniqueID}//------------------------------------------------------------------------//// Function: fnGetReadOnly / fnPutReadOnly//// Synopsis: The readOnly property can be set to true or false to // disable user date selection by clicking on days or through// the select controls//// Arguments: The put method requires a true/false value//// Returns: The get method will return true or false//// Notes: none////------------------------------------------------------------------------function fnGetReadOnly(){ return (gbReadOnly) ? true : false}function fnPutReadOnly(bReadOnly){ if (gbLoading) return // return if the behavior is loading if ((bReadOnly) != gbReadOnly) { gbReadOnly = (bReadOnly) ? true : false fnFireOnPropertyChange("propertyName", "readOnly") } element.children[0].rows[0].cells[1].children[0].children[0].disabled = gbReadOnly element.children[0].rows[0].cells[1].children[0].children[1].disabled = gbReadOnly}// **********************************************************************// CALENDAR INITIALIZATION FUNCTIONS// **********************************************************************//------------------------------------------------------------------------//// Function: fnCreateCalendarHTML//// Synopsis: This function adds the HTML code to the main document that// is required to display the calendar. It contains nested// tables and all style information is inherited from the // style sheet properties.//// Arguments: none//// Returns: none//// Notes: none////------------------------------------------------------------------------function fnCreateCalendarHTML(){ var row, cell element.innerHTML = '<table border=0 class=WholeCalendar_' + uniqueID + '> ' + ' <tr> ' + ' <td class=Title_' + uniqueID + '></td> ' + ' <td class=DateControls_' + uniqueID + '> ' + ' <nobr> <select></select> ' + ' <select></select> </nobr> </td> ' + ' </tr> ' + ' <tr> <td colspan=3> ' + ' <table class=CalTable_' + uniqueID + ' cellspacing=0 border=0> ' + ' <tr><td class=DayTitle_' + uniqueID + '></td>' + ' <td class=DayTitle_' + uniqueID + '></td>' + ' <td class=DayTitle_' + uniqueID + '></td>' + ' <td class=DayTitle_' + uniqueID + '></td>' + ' <td class=DayTitle_' + uniqueID + '></td>' + ' <td class=DayTitle_' + uniqueID + '></td>' + ' <td class=DayTitle_' + uniqueID + '></td></tr>' + ' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' + ' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' + ' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' + ' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' + ' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' + ' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' + ' </table> ' + ' </tr> ' + '</table> '; goDayTitleRow = element.children[0].rows[1].cells[0].children[0].rows[0] goMonthSelect = element.children[0].rows[0].cells[1].children[0].children[0] goYearSelect = element.children[0].rows[0].cells[1].children[0].children[1] for (row=1; row < 7; row++) for (cell=0; cell < 7; cell++) gaDayCell[((row-1)*7) + cell] = element.children[0].rows[1].cells[0].children[0].rows[row].cells[cell]}//------------------------------------------------------------------------//// Function: fnCreateStyleSheets//// Synopsis: The calendar uses a style sheet to control the rendering// of the different calendar elements. This function creates// the style sheet in the main document using a unique name.//// Arguments: none//// Returns: //// Notes: ////------------------------------------------------------------------------function fnCreateStyleSheets(){ var StyleInfo if (! element.document.body.BehaviorStyleSheet) { element.document.body.BehaviorStyleSheet = element.document.createStyleSheet() } StyleInfo = element.document.body.BehaviorStyleSheet StyleInfo.addRule( '.WholeCalendar_' + uniqueID, 'background-color : lightgrey ;'+ 'border : 1px solid black ;'+ 'cursor : default ;'+ 'width : 100% ;'+ 'height : 100% ;' ) goStyle['WholeCalendar'] = StyleInfo.rules[StyleInfo.rules.length - 1].style StyleInfo.addRule( '.Title_' + uniqueID, 'color : #00009F ;'+ // cal--title-color 'font-family : Arial ;'+ // cal--title-font-family 'font-size : 10pt ;'+ // cal--title-font-size 'font-weight : bold ;'+ // cal--title-font-weight 'text-align : center ;'+ // cal--title-text-align 'height : 1 ;'+ 'width : 100% ;'+ 'background-color : lightgrey;' ) goStyle['Title'] = StyleInfo.rules[StyleInfo.rules.length - 1].style fnLoadCSSDefault('cal--title-background-color', 'calTitleBackgroundColor', goStyle['Title'], 'backgroundColor') fnLoadCSSDefault('cal--title-color', 'calTitleColor', goStyle['Title'], 'color') fnLoadCSSDefault('cal--title-font-family', 'calTitleFontFamily', goStyle['Title'], 'fontFamily') fnLoadCSSDefault('cal--title-font-size', 'calTitleFontSize', goStyle['Title'], 'fontSize') fnLoadCSSDefault('cal--title-font-weight', 'calTitleFontWeight', goStyle['Title'], 'fontWeight') fnLoadCSSDefault('cal--title-text-align', 'calTitleTextAlign', goStyle['Title'], 'textAlign') StyleInfo.addRule( '.DateControls_' + uniqueID, 'text-align : right ;' ) goStyle['DateControls'] = StyleInfo.rules[StyleInfo.rules.length - 1].style StyleInfo.addRule( '.CalTable_' + uniqueID, 'border : 1 solid black ;'+ 'width : 100% ;'+ 'height : 100% ;' ) goStyle['CalTable'] = StyleInfo.rules[StyleInfo.rules.length - 1].style StyleInfo.addRule( '.DayTitle_' + uniqueID, 'background-color : lightgrey ;'+ // dayTitle-background-color 'color : black ;'+ // dayTitle-color 'font-family : Arial ;'+ // dayTitle-font-family 'font-size : 8pt ;'+ // dayTitle-font-size 'font-weight : bold ;'+ // dayTitle-font-weight 'text-align : center ;'+ // dayTitle-text-align 'border-width : 1px ;'+ 'border-style : solid ;'+ 'border-left-color : white ;'+ 'border-top-color : white ;'+ 'border-right-color : black ;'+ 'border-bottom-color : black ;'+ 'width : 14% ;'+ 'height : 1 ;' ) goStyle['DayTitle'] = StyleInfo.rules[StyleInfo.rules.length - 1].style fnLoadCSSDefault('cal--dayTitle-background-color', 'calDayTitleBackgroundColor', goStyle['DayTitle'], 'backgroundColor') fnLoadCSSDefault('cal--dayTitle-color', 'calDayTitleColor', goStyle['DayTitle'], 'color') fnLoadCSSDefault('cal--dayTitle-font-family', 'calDayTitleFontFamily', goStyle['DayTitle'], 'fontFamily') fnLoadCSSDefault('cal--dayTitle-font-size', 'calDayTitleFontSize', goStyle['DayTitle'], 'fontSize') fnLoadCSSDefault('cal--dayTitle-font-weight', 'calDayTitleFontWeight', goStyle['DayTitle'], 'fontWeight') fnLoadCSSDefault('cal--dayTitle-text-align', 'calDayTitleTextAlign', goStyle['DayTitle'], 'textAlign') StyleInfo.addRule( '.OffDay_' + uniqueID, 'background-color : lightgrey ;'+ // cal--offMonth-background-color 'color : #7F7F7F ;'+ // cal--offMonth-color 'font-family : Arial ;'+ // cal--offMonth-font-family 'font-size : 8pt ;'+ // cal--offMonth-font-size 'font-weight : normal ;'+ // cal--offMonth-font-weight 'text-align : right ;'+ // cal--offMonth-text-align 'vertical-align : text-top ;'+ // cal--offMonth-vertical-align 'border-width : 1px ;'+ 'border-style : solid ;'+ 'border-left-color : white ;'+ 'border-top-color : white ;'+ 'border-right-color : black ;'+ 'border-bottom-color : black ;'+ 'width : 14% ;'+ 'cursor : hand ;' ) goStyle['OffDay'] = StyleInfo.rules[StyleInfo.rules.length - 1].style fnLoadCSSDefault('cal--offMonth-background-color', 'calOffMonthBackgroundColor', goStyle['OffDay'], 'backgroundColor') fnLoadCSSDefault('cal--offMonth-color', 'calOffMonthColor', goStyle['OffDay'], 'color') fnLoadCSSDefault('cal--offMonth-font-family', 'calOffMonthFontFamily', goStyle['OffDay'], 'fontFamily') fnLoadCSSDefault('cal--offMonth-font-size', 'calOffMonthFontSize', goStyle['OffDay'], 'fontSize') fnLoadCSSDefault('cal--offMonth-font-weight', 'calOffMonthFontWeight', goStyle['OffDay'], 'fontWeight') fnLoadCSSDefault('cal--offMonth-text-align', 'calOffMonthTextAlign', goStyle['OffDay'], 'textAlign') fnLoadCSSDefault('cal--offMonth-vertical-align', 'calOffMonthVerticalAlign', goStyle['OffDay'], 'verticalAlign') StyleInfo.addRule( '.Day_' + uniqueID, 'background-color : lightgrey ;'+ // cal--currentMonth-background-color 'color : #00009F ;'+ // cal--currentMonth-color 'font-family : Arial ;'+ // cal--currentMonth-font-family 'font-size : 8pt ;'+ // cal--currentMonth-font-size 'font-weight : normal ;'+ // cal--currentMonth-font-weight 'text-align : right ;'+ // cal--currentMonth-text-align 'vertical-align : text-top ;'+ // cal--currentMonth-vertical-align 'border-width : 1px ;'+ 'border-style : solid ;'+ 'border-left-color : white ;'+ 'border-top-color : white ;'+ 'border-right-color : black ;'+ 'border-bottom-color : black ;'+ 'width : 14% ;'+ 'cursor : hand ;' ) goStyle['Day'] = StyleInfo.rules[StyleInfo.rules.length - 1].style fnLoadCSSDefault('cal--currentMonth-background-color', 'calCurrentMonthBackgroundColor', goStyle['Day'], 'backgroundColor') fnLoadCSSDefault('cal--currentMonth-color', 'calCurrentMonthColor', goStyle['Day'], 'color') fnLoadCSSDefault('cal--currentMonth-font-family', 'calCurrentMonthFontFamily', goStyle['Day'], 'fontFamily') fnLoadCSSDefault('cal--currentMonth-font-size', 'calCurrentMonthFontSize', goStyle['Day'], 'fontSize') fnLoadCSSDefault('cal--currentMonth-font-weight', 'calCurrentMonthFontWeight', goStyle['Day'], 'fontWeight') fnLoadCSSDefault('cal--currentMonth-text-align', 'calCurrentMonthTextAlign', goStyle['Day'], 'textAlign') fnLoadCSSDefault('cal--currentMonth-vertical-align', 'calCurrentMonthVerticalAlign', goStyle['Day'], 'verticalAlign') StyleInfo.addRule( '.DaySelected_' + uniqueID, 'background-color : #7F7F7F ;'+ // cal--selectedDay-background-color 'color : yellow ;'+ // cal--selectedDay-color 'font-family : Arial ;'+ // cal--selectedDay-font-family 'font-size : 8pt ;'+ // cal--selectedDay-font-size 'font-weight : normal ;'+ // cal--selectedDay-font-weight 'text-align : right ;'+ // cal--selectedMonth-text-align 'vertical-align : text-top ;'+ // cal--selectedMonth-vertical-align 'border-width : 1px ;'+ 'border-style : solid ;'+ 'border-left-color : black ;'+ 'border-top-color : black ;'+ 'border-right-color : #BFBFBF ;'+
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -