这个是微软的: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML xmlns:IE> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0"> <TITLE>日历</TITLE> <style> @media all { IE\:Calendar { behavior: url(calendar.htc) ; width : 33%; } } </style> <script id=clientEventHandlersJS language=javascript> <!--function cal_dblclick() { window.parent.document.all(window.parent.document.all("myCal").className).value=cal.year + "/" + cal.month + "/" + cal.day; window.parent.document.all("myCal").style.visibility="hidden"; }//--> </script> </HEAD> <BODY topMargin="0" leftMargin="0"> <IE:Calendar id="cal" ondblclick="return cal_dblclick()" style="width : 300; height : 275; border : 0px solid black;POSITION:absolute"></IE:Calendar> </BODY> </HTML> 引用: <!-- ---------------------------------------------------------------------// // 月历部份版权为 Microsoft 所有 // 农历部份版权为 Sean Lin ([email protected]) 所有 // // Copyright 1999 Microsoft Corporation. All Rights Reserved. // // File: calendar.htc // // Description: The calendar behavior provides an easy, declarative way // to add a standard calendar control to web pages and html // based applications. It provides a variety of properties // to customize the look and feel along with a strong set // events and functionality. // //-------------------------------------------------------------------- --><script language="javascript">//------------------------------------------------------------------------ // Attach to element events //------------------------------------------------------------------------element.attachEvent("onselectstart", fnOnSelectStart) element.attachEvent("onclick", fnOnClick) element.attachEvent("onpropertychange", fnOnPropertyChange) element.attachEvent("onreadystatechange", fnOnReadyStateChange)//------------------------------------------------------------------------ // Create the arrays of days & months for different languages //------------------------------------------------------------------------
var gaMonthNames = new Array( new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), new Array('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月') // Sean 增加 );var gaDayNames = new Array( new Array('S', 'M', 'T', 'W', 'T', 'F', 'S'), new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'), new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六') // Sean 增加 );var gaMonthDays = new Array( /* Jan */ 31, /* Feb */ 29, /* Mar */ 31, /* Apr */ 30, /* May */ 31, /* Jun */ 30, /* Jul */ 31, /* Aug */ 31, /* Sep */ 30, /* Oct */ 31, /* Nov */ 30, /* Dec */ 31 )//农历资料 var lunarInfo=new Array( 0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2, 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977, 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970, 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950, 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557, 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0, 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0, 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6, 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570, 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0, 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5, 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930, 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530, 0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45, 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸"); var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"); var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"); var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至") var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758) var nStr1 = new Array('一','二','三','四','五','六','七','八','九','十') var nStr2 = new Array('初','十','廿','卅','卌')//国历节日 *表示放假日 var sFtv = new Array( "0101*元旦", "0501 劳动节")//农历节日 *表示放假日 var lFtv = new Array( "0101*春节", "0100*除夕")
//某月的第几个星期几 var wFtv = new Array( "0131 Martin Luther King Day", "1021 Columbus Day", "1144 Thanksgiving")var StyleInfo = null // Style sheet with rules for this calendar var goStyle = new Object() // A hash of style sheet rules that apply to this calendar var gaDayCell = new Array() // an array of the table cells for days var goDayTitleRow = null // The table row containing days of the week var goYearSelect = null // The year select control var goMonthSelect = null // The month select control var goCurrentDayCell = null // The cell for the currently selected day var giStartDayIndex = 0 // The index in gaDayCell for the first day of the month var gbLoading = true // Flag for if the behavior is loadingvar giDay // day of the month (1 to 31) var giMonth // month of the year (1 to 12) var giYear // year (1900 to 2099)var giMonthLength = 2 // month length (0 to 2) Sean 更改 2为中文 var giDayLength = 3 // day length (0 to 3) Sean 更改 3为中文 var giFirstDay = 0 // first day of the week (0 to 6) var gsGridCellEffect = 'raised' // Grid cell effect var gsGridLinesColor = 'black' // Grid line color var gbShowDateSelectors = true // Show date selectors (0,1) var gbShowDays = true // Show the days of the week titles (0,1) var gbShowTitle = true // Show the title (0,1) var gbShowHorizontalGrid = true // Show the horizontal grid (0,1) var gbShowVerticalGrid = true // Show the vertical grid (0,1) var gbValueIsNull = false // There is no value selected (0,1) var gbReadOnly = false // The user can not interact with the controlvar giMinYear = 1900 // Minimum year (1 is the lowest possible value) var giMaxYear = 2049 // Maximum yearvar gbShowLunar = true // 显示农历 var gbChineseTitle = true // 显示中文标题
// Load the property values defined on the element to replace defaults fnGetPropertyDefaults()// Create the style sheets needed for the calendar display fnCreateStyleSheets()// Insert the HTML elements needed for the calendar display fnCreateCalendarHTML()// Update the title with the month and year fnUpdateTitle()// Fill in the days of the week fnUpdateDayTitles()// Build the month select control fnBuildMonthSelect()// Build the year select control fnBuildYearSelect()// Fill in the cells with the days of the month and set style values fnFillInCells()// ********************************************************************** // PROPERTY GET/SET FUNCTIONS // ********************************************************************** //------------------------------------------------------------------------ // // Function: fnGetDay / fnPutDay // // Synopsis: The day property is used to set the day of the month. The // valid range is from 1 to the maximum day of the selected // month & year. If a number is given outside that range, it // is set to the closest valid value. Invalid input will cause // an exception. // // Arguments: The put method requires an integer value for the day // // Returns: The get method will return the selected day of the month // If the valueIsNull property is set, null is returned // // Notes: none // //------------------------------------------------------------------------function fnGetDay() { return (gbValueIsNull) ? null : giDay }function fnPutDay(iDay) { if (gbLoading) return // return if the behavior is loading iDay = parseInt(iDay) if (isNaN(iDay)) throw 450 fnSetDate(iDay, giMonth, giYear) }//------------------------------------------------------------------------ // // Function: fnGetMonth / fnPutMonth // // Synopsis: The month property is used to set the month of the year. // The valid range is from 1 to 12. If a value is given // outside that range, it is set to the closest valid value. // Invalid input will cause an exception. // // Arguments: The put method requires an integer value for the month // // Returns: The get method will return the selected month value // If the valueIsNull property is set, null is returned // // Notes: Setting the year can cause the selected "day" value to be // reduced to the highest day in the selected month if needed. // //------------------------------------------------------------------------function fnGetMonth() { return (gbValueIsNull) ? null : giMonth }function fnPutMonth(iMonth) { if (gbLoading) return // return if the behavior is loading iMonth = parseInt(iMonth) if (isNaN(iMonth)) throw 450 fnSetDate(giDay, iMonth, giYear) }//------------------------------------------------------------------------ // // Function: fnGetYear / fnPutYear // // Synopsis: The year property is used to set the current year. // The valid range is from minYear to maxYear. If a value is given // outside that range, it is set to the closest valid value. // Invalid input will cause an exception. // // Arguments: The put method requires an integer value for the year // // Returns: The get method will return the selected year value // If the valueIsNull property is set, null is returned. // // Notes: Setting the year can cause the selected "day" value to be // reduced to the highest day in the selected month if needed. // //------------------------------------------------------------------------function fnGetYear() { return (gbValueIsNull) ? null : giYear }function fnPutYear(iYear) { if (gbLoading) return // return if the behavior is loading iYear = parseInt(iYear) if (isNaN(iYear)) throw 450 fnSetDate(giDay, giMonth, iYear) }//------------------------------------------------------------------------ // // Function: fnGetMonthLength / fnPutMonthLength // // Synopsis: The monthLength property is used to adjust the length of // the month name used in the title and month selection control. // // Arguments: The put method requires a value of 'short' or 'long' // // Returns: The get method will return a value of 'short' or 'long' // // Notes: none // //------------------------------------------------------------------------function fnGetMonthLength() { if (giMonthLength == 0) return "short" if (giMonthLength == 1) return "long" if (giMonthLength == 2) return "chinese" // Add by Senan }function fnPutMonthLength(sLength) { if (gbLoading) return // return if the behavior is loading switch (sLength.toLowerCase()) { case "short" : if (giMonthLength == 0) return giMonthLength = 0 break; case "long" : if (giMonthLength == 1) return giMonthLength = 1 break; case "chinese" : // Add By Sean if (giMonthLength == 2) return giMonthLength = 2 break; default : throw 450 return } fnUpdateTitle() fnBuildMonthSelect() }//------------------------------------------------------------------------ // // Function: fnGetDayLength / fnPutDayLength // // Synopsis: The dayLength property is used to adjust the length of // the day names in the calendar grid. // // Arguments: The put method requires a value of 'short', 'medium', // or 'long' // // Returns: The get method will return a value of 'short', 'medium', // or 'long' // // Notes: none // //------------------------------------------------------------------------function fnGetDayLength() { if (giDayLength == 0) return "short" if (giDayLength == 1) return "medium" if (giDayLength == 2) return "long" if (giDayLength == 3) return "chinese" }function fnPutDayLength(sLength) { if (gbLoading) return // return if the behavior is loading switch (sLength.toLowerCase()) { case "short" : if (giDayLength == 0) return giDayLength = 0 break; case "medium" : if (giDayLength == 1) return giDayLength = 1 break;
case "long" : if (giDayLength == 2) return giDayLength = 2 break; case "chinese" : if (giDayLength == 3) return giDayLength = 3 break; default : throw 450 return } fnUpdateDayTitles() // Used to force a table resize if needed goStyle['DaySelected'].borderStyle = 'solid' }//------------------------------------------------------------------------ // // Function: fnGetFirstDay / fnPutFirstDay // // Synopsis: The firstDay property is used to adjust the first day of // the week on the calendar grid. Valid values are 1 to 7 // where 1 is Sunday and 7 is Saturday. Setting to an invalid // value will cause an exception. // // Arguments: The put method requires a value from 1 to 7 // // Returns: The get method will return a value from 1 to 7 // // Notes: none // //------------------------------------------------------------------------function fnGetFirstDay() { return giFirstDay }function fnPutFirstDay(iFirstDay) { if (gbLoading) return // return if the behavior is loading if ((iFirstDay < 0) || (iFirstDay > 6)) throw 450 if (giFirstDay == iFirstDay) return giFirstDay = iFirstDay fnUpdateDayTitles() fnFillInCells() }//------------------------------------------------------------------------ // // Function: fnGetGridCellEffect / fnPutGridCellEffect // // Synopsis: The gridCellEffect property is used to modify the 3D effect // in the calendar grid (excluding day titles). It can take // values of 'raised', 'flat', or 'sunken'. Other values will // cause an exception. // // Arguments: The put method requires a value of 'raised', 'flat', or // 'sunken'. // // Returns: The get method will return a value of 'raised', 'flat', or // 'sunken'. // // Notes: none // //------------------------------------------------------------------------function fnGetGridCellEffect() { return gsGridCellEffect }function fnPutGridCellEffect(sEffect) { if (gbLoading) return // return if the behavior is loading switch (sEffect.toLowerCase()) { case "raised" : if (gsGridCellEffect == 'raised') return gsGridCellEffect = 'raised' fnUpdateGridColors() break case "flat" : if (gsGridCellEffect == 'flat') return gsGridCellEffect = 'flat' fnUpdateGridColors() break case "sunken" : if (gsGridCellEffect == 'sunken') return gsGridCellEffect = 'sunken' fnUpdateGridColors() break default : throw 450 } }//------------------------------------------------------------------------ // // Function: fnGetGridLinesColor / fnPutGridLinesColor // // Synopsis: The gridLinesColor property is used to change the color of // the calendar grid when the gridCellEffect property is set // to 'flat'. It can be any valid HTML color value. // // Arguments: The put method requires a HTML color value // // Returns: The get method will return a HTML color value // // Notes: No error checking is performed. Invalid values may result // in unexpected rendering. // //------------------------------------------------------------------------function fnGetGridLinesColor() { return gsGridLinesColor }
function fnPutGridLinesColor(sGridLinesColor) { if (gbLoading) return // return if the behavior is loading gsGridLinesColor = sGridLinesColor fnUpdateGridColors() }//------------------------------------------------------------------------ // // Function: fnGetShowVerticalGrid / fnPutShowVerticalGrid // // Synopsis: The showVerticalGrid property is used to toggle the // visibility of vertical 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 fnGetShowVerticalGrid() { return gbShowVerticalGrid }function fnPutShowVerticalGrid(bShowVerticalGrid) { if (gbLoading) return // return if the behavior is loading if ((bShowVerticalGrid) != gbShowVerticalGrid) { gbShowVerticalGrid = (bShowVerticalGrid) ? true : false fnFireOnPropertyChange("propertyName", "showVerticalGrid") fnUpdateGridColors() } } //------------------------------------------------------------------------ // // Function: fnGetShowHorizontalGrid / fnPutShowHorizontalGrid // // 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 // //------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML xmlns:IE>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
<TITLE>日历</TITLE>
<style>
@media all
{
IE\:Calendar
{
behavior: url(calendar.htc) ;
width : 33%;
}
}
</style>
<script id=clientEventHandlersJS language=javascript>
<!--function cal_dblclick() {
window.parent.document.all(window.parent.document.all("myCal").className).value=cal.year + "/" + cal.month + "/" + cal.day;
window.parent.document.all("myCal").style.visibility="hidden";
}//-->
</script>
</HEAD>
<BODY topMargin="0" leftMargin="0">
<IE:Calendar id="cal" ondblclick="return cal_dblclick()" style="width : 300; height : 275; border : 0px solid black;POSITION:absolute"></IE:Calendar>
</BODY>
</HTML>
引用:
<!-- ---------------------------------------------------------------------//
// 月历部份版权为 Microsoft 所有
// 农历部份版权为 Sean Lin ([email protected]) 所有
//
// Copyright 1999 Microsoft Corporation. All Rights Reserved.
//
// File: calendar.htc
//
// Description: The calendar behavior provides an easy, declarative way
// to add a standard calendar control to web pages and html
// based applications. It provides a variety of properties
// to customize the look and feel along with a strong set
// events and functionality.
//
//-------------------------------------------------------------------- --><script language="javascript">//------------------------------------------------------------------------
// Attach to element events
//------------------------------------------------------------------------element.attachEvent("onselectstart", fnOnSelectStart)
element.attachEvent("onclick", fnOnClick)
element.attachEvent("onpropertychange", fnOnPropertyChange)
element.attachEvent("onreadystatechange", fnOnReadyStateChange)//------------------------------------------------------------------------
// Create the arrays of days & months for different languages
//------------------------------------------------------------------------
new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
new Array('January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'),
new Array('一月', '二月', '三月', '四月', '五月', '六月', '七月',
'八月', '九月', '十月', '十一月', '十二月') // Sean 增加
);var gaDayNames = new Array(
new Array('S', 'M', 'T', 'W', 'T', 'F', 'S'),
new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六') // Sean 增加
);var gaMonthDays = new Array(
/* Jan */ 31, /* Feb */ 29, /* Mar */ 31, /* Apr */ 30,
/* May */ 31, /* Jun */ 30, /* Jul */ 31, /* Aug */ 31,
/* Sep */ 30, /* Oct */ 31, /* Nov */ 30, /* Dec */ 31 )//农历资料
var lunarInfo=new Array(
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,
0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,
0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,
0x06ca0,0x0b550,0x15355,0x04da0,0x0a5d0,0x14573,0x052d0,0x0a9a8,0x0e950,0x06aa0,
0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x195a6,
0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,
0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,
0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,
0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0)var solarMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
var solarTerm = new Array("小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至")
var sTermInfo = new Array(0,21208,42467,63836,85337,107014,128867,150921,173149,195551,218072,240693,263343,285989,308563,331033,353350,375494,397447,419210,440795,462224,483532,504758)
var nStr1 = new Array('一','二','三','四','五','六','七','八','九','十')
var nStr2 = new Array('初','十','廿','卅','卌')//国历节日 *表示放假日
var sFtv = new Array(
"0101*元旦",
"0501 劳动节")//农历节日 *表示放假日
var lFtv = new Array(
"0101*春节",
"0100*除夕")
var wFtv = new Array(
"0131 Martin Luther King Day",
"1021 Columbus Day",
"1144 Thanksgiving")var StyleInfo = null // Style sheet with rules for this calendar
var goStyle = new Object() // A hash of style sheet rules that apply to this calendar
var gaDayCell = new Array() // an array of the table cells for days
var goDayTitleRow = null // The table row containing days of the week
var goYearSelect = null // The year select control
var goMonthSelect = null // The month select control
var goCurrentDayCell = null // The cell for the currently selected day
var giStartDayIndex = 0 // The index in gaDayCell for the first day of the month
var gbLoading = true // Flag for if the behavior is loadingvar giDay // day of the month (1 to 31)
var giMonth // month of the year (1 to 12)
var giYear // year (1900 to 2099)var giMonthLength = 2 // month length (0 to 2) Sean 更改 2为中文
var giDayLength = 3 // day length (0 to 3) Sean 更改 3为中文
var giFirstDay = 0 // first day of the week (0 to 6)
var gsGridCellEffect = 'raised' // Grid cell effect
var gsGridLinesColor = 'black' // Grid line color
var gbShowDateSelectors = true // Show date selectors (0,1)
var gbShowDays = true // Show the days of the week titles (0,1)
var gbShowTitle = true // Show the title (0,1)
var gbShowHorizontalGrid = true // Show the horizontal grid (0,1)
var gbShowVerticalGrid = true // Show the vertical grid (0,1)
var gbValueIsNull = false // There is no value selected (0,1)
var gbReadOnly = false // The user can not interact with the controlvar giMinYear = 1900 // Minimum year (1 is the lowest possible value)
var giMaxYear = 2049 // Maximum yearvar gbShowLunar = true // 显示农历
var gbChineseTitle = true // 显示中文标题
fnGetPropertyDefaults()// Create the style sheets needed for the calendar display
fnCreateStyleSheets()// Insert the HTML elements needed for the calendar display
fnCreateCalendarHTML()// Update the title with the month and year
fnUpdateTitle()// Fill in the days of the week
fnUpdateDayTitles()// Build the month select control
fnBuildMonthSelect()// Build the year select control
fnBuildYearSelect()// Fill in the cells with the days of the month and set style values
fnFillInCells()// **********************************************************************
// PROPERTY GET/SET FUNCTIONS
// **********************************************************************
//------------------------------------------------------------------------
//
// Function: fnGetDay / fnPutDay
//
// Synopsis: The day property is used to set the day of the month. The
// valid range is from 1 to the maximum day of the selected
// month & year. If a number is given outside that range, it
// is set to the closest valid value. Invalid input will cause
// an exception.
//
// Arguments: The put method requires an integer value for the day
//
// Returns: The get method will return the selected day of the month
// If the valueIsNull property is set, null is returned
//
// Notes: none
//
//------------------------------------------------------------------------function fnGetDay()
{
return (gbValueIsNull) ? null : giDay
}function fnPutDay(iDay)
{
if (gbLoading) return // return if the behavior is loading iDay = parseInt(iDay)
if (isNaN(iDay)) throw 450 fnSetDate(iDay, giMonth, giYear)
}//------------------------------------------------------------------------
//
// Function: fnGetMonth / fnPutMonth
//
// Synopsis: The month property is used to set the month of the year.
// The valid range is from 1 to 12. If a value is given
// outside that range, it is set to the closest valid value.
// Invalid input will cause an exception.
//
// Arguments: The put method requires an integer value for the month
//
// Returns: The get method will return the selected month value
// If the valueIsNull property is set, null is returned
//
// Notes: Setting the year can cause the selected "day" value to be
// reduced to the highest day in the selected month if needed.
//
//------------------------------------------------------------------------function fnGetMonth()
{
return (gbValueIsNull) ? null : giMonth
}function fnPutMonth(iMonth)
{
if (gbLoading) return // return if the behavior is loading iMonth = parseInt(iMonth)
if (isNaN(iMonth)) throw 450 fnSetDate(giDay, iMonth, giYear)
}//------------------------------------------------------------------------
//
// Function: fnGetYear / fnPutYear
//
// Synopsis: The year property is used to set the current year.
// The valid range is from minYear to maxYear. If a value is given
// outside that range, it is set to the closest valid value.
// Invalid input will cause an exception.
//
// Arguments: The put method requires an integer value for the year
//
// Returns: The get method will return the selected year value
// If the valueIsNull property is set, null is returned.
//
// Notes: Setting the year can cause the selected "day" value to be
// reduced to the highest day in the selected month if needed.
//
//------------------------------------------------------------------------function fnGetYear()
{
return (gbValueIsNull) ? null : giYear
}function fnPutYear(iYear)
{
if (gbLoading) return // return if the behavior is loading iYear = parseInt(iYear)
if (isNaN(iYear)) throw 450 fnSetDate(giDay, giMonth, iYear)
}//------------------------------------------------------------------------
//
// Function: fnGetMonthLength / fnPutMonthLength
//
// Synopsis: The monthLength property is used to adjust the length of
// the month name used in the title and month selection control.
//
// Arguments: The put method requires a value of 'short' or 'long'
//
// Returns: The get method will return a value of 'short' or 'long'
//
// Notes: none
//
//------------------------------------------------------------------------function fnGetMonthLength()
{
if (giMonthLength == 0) return "short"
if (giMonthLength == 1) return "long"
if (giMonthLength == 2) return "chinese" // Add by Senan
}function fnPutMonthLength(sLength)
{
if (gbLoading) return // return if the behavior is loading switch (sLength.toLowerCase())
{
case "short" :
if (giMonthLength == 0) return
giMonthLength = 0
break;
case "long" :
if (giMonthLength == 1) return
giMonthLength = 1
break;
case "chinese" : // Add By Sean
if (giMonthLength == 2) return
giMonthLength = 2
break;
default :
throw 450
return
} fnUpdateTitle()
fnBuildMonthSelect()
}//------------------------------------------------------------------------
//
// Function: fnGetDayLength / fnPutDayLength
//
// Synopsis: The dayLength property is used to adjust the length of
// the day names in the calendar grid.
//
// Arguments: The put method requires a value of 'short', 'medium',
// or 'long'
//
// Returns: The get method will return a value of 'short', 'medium',
// or 'long'
//
// Notes: none
//
//------------------------------------------------------------------------function fnGetDayLength()
{
if (giDayLength == 0) return "short"
if (giDayLength == 1) return "medium"
if (giDayLength == 2) return "long"
if (giDayLength == 3) return "chinese"
}function fnPutDayLength(sLength)
{
if (gbLoading) return // return if the behavior is loading switch (sLength.toLowerCase())
{
case "short" :
if (giDayLength == 0) return
giDayLength = 0
break;
case "medium" :
if (giDayLength == 1) return
giDayLength = 1
break;
if (giDayLength == 2) return
giDayLength = 2
break;
case "chinese" :
if (giDayLength == 3) return
giDayLength = 3
break;
default :
throw 450
return
} fnUpdateDayTitles() // Used to force a table resize if needed
goStyle['DaySelected'].borderStyle = 'solid'
}//------------------------------------------------------------------------
//
// Function: fnGetFirstDay / fnPutFirstDay
//
// Synopsis: The firstDay property is used to adjust the first day of
// the week on the calendar grid. Valid values are 1 to 7
// where 1 is Sunday and 7 is Saturday. Setting to an invalid
// value will cause an exception.
//
// Arguments: The put method requires a value from 1 to 7
//
// Returns: The get method will return a value from 1 to 7
//
// Notes: none
//
//------------------------------------------------------------------------function fnGetFirstDay()
{
return giFirstDay
}function fnPutFirstDay(iFirstDay)
{
if (gbLoading) return // return if the behavior is loading
if ((iFirstDay < 0) || (iFirstDay > 6)) throw 450
if (giFirstDay == iFirstDay) return
giFirstDay = iFirstDay fnUpdateDayTitles()
fnFillInCells()
}//------------------------------------------------------------------------
//
// Function: fnGetGridCellEffect / fnPutGridCellEffect
//
// Synopsis: The gridCellEffect property is used to modify the 3D effect
// in the calendar grid (excluding day titles). It can take
// values of 'raised', 'flat', or 'sunken'. Other values will
// cause an exception.
//
// Arguments: The put method requires a value of 'raised', 'flat', or
// 'sunken'.
//
// Returns: The get method will return a value of 'raised', 'flat', or
// 'sunken'.
//
// Notes: none
//
//------------------------------------------------------------------------function fnGetGridCellEffect()
{
return gsGridCellEffect
}function fnPutGridCellEffect(sEffect)
{
if (gbLoading) return // return if the behavior is loading switch (sEffect.toLowerCase())
{
case "raised" :
if (gsGridCellEffect == 'raised') return
gsGridCellEffect = 'raised'
fnUpdateGridColors()
break
case "flat" :
if (gsGridCellEffect == 'flat') return
gsGridCellEffect = 'flat'
fnUpdateGridColors()
break
case "sunken" :
if (gsGridCellEffect == 'sunken') return
gsGridCellEffect = 'sunken'
fnUpdateGridColors()
break
default :
throw 450
}
}//------------------------------------------------------------------------
//
// Function: fnGetGridLinesColor / fnPutGridLinesColor
//
// Synopsis: The gridLinesColor property is used to change the color of
// the calendar grid when the gridCellEffect property is set
// to 'flat'. It can be any valid HTML color value.
//
// Arguments: The put method requires a HTML color value
//
// Returns: The get method will return a HTML color value
//
// Notes: No error checking is performed. Invalid values may result
// in unexpected rendering.
//
//------------------------------------------------------------------------function fnGetGridLinesColor()
{
return gsGridLinesColor
}
{
if (gbLoading) return // return if the behavior is loading gsGridLinesColor = sGridLinesColor
fnUpdateGridColors()
}//------------------------------------------------------------------------
//
// Function: fnGetShowVerticalGrid / fnPutShowVerticalGrid
//
// Synopsis: The showVerticalGrid property is used to toggle the
// visibility of vertical 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 fnGetShowVerticalGrid()
{
return gbShowVerticalGrid
}function fnPutShowVerticalGrid(bShowVerticalGrid)
{
if (gbLoading) return // return if the behavior is loading if ((bShowVerticalGrid) != gbShowVerticalGrid)
{
gbShowVerticalGrid = (bShowVerticalGrid) ? true : false
fnFireOnPropertyChange("propertyName", "showVerticalGrid")
fnUpdateGridColors()
}
}
//------------------------------------------------------------------------
//
// Function: fnGetShowHorizontalGrid / fnPutShowHorizontalGrid
//
// 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
//
//------------------------------------------------------------------------