<Script language = "JavaScript">
VaR months = new array ("1", "2", "3", "4", "5", "6", "7", "8 ", "9", "10", "11", "12 ");
VaR daysinmonth = new array (31, 28, 31, 30, 31, 30, 31, 31, 31, 31, 31 );
VaR days = new array ("day", "one", "two", "three", "four", "five", "Six ");
VaR classtemp;
VaR today = new gettoday ();
VaR year = today. Year;
VaR month = today. month;
VaR newcal;
Function getdays (month, year ){
If (1 = month) Return (0 = year % 4) & (0! = (Year % 100) | (0 = year % 400 )? 29: 28;
Else return daysinmonth [month];
}
Function gettoday (){
This. Now = new date ();
This. Year = this. Now. getfullyear ();
This. month = this. Now. getmonth ();
This. Day = this. Now. getdate ();
}
Function calendar (){
Newcal = new date (year, month, 1 );
Today = new gettoday ();
VaR day =-1;
VaR startday = newcal. getday ();
VaR endday = getdays (newcal. getmonth (), newcal. getfullyear ());
VaR daily = 0;
If (today. Year = newcal. getfullyear () & (today. month = newcal. getmonth ()))
{
Day = today. Day;
}
VaR caltable = Document. All. caltable. tbodies. calendar;
VaR intdaysinmonth = getdays (newcal. getmonth (), newcal. getfullyear ());
For (VAR intweek = 0; intweek <caltable. Rows. length; intweek ++)
For (VAR intday = 0; intday <caltable. Rows [intweek]. cells. length; intday ++)
{
VaR cell = caltable. Rows [intweek]. cells [intday];
VaR Monte MP = (newcal. getmonth () + 1) <10? ("0" + (newcal. getmonth () + 1) :( newcal. getmonth () + 1 );
If (intday = startday) & (0 = daily) {daily = 1 ;}
VaR daytemp = daily <10? ("0" + daily) :( daily );
VaR d = "<" + newcal. getfullyear () + "-" + Monte MP + "-" + daytemp + "> ";
If (Day = daily) cell. classname = "daynow ";
Else if (intday = 6) cell. classname = "daysat ";
Else if (intday = 0) cell. classname = "daysun ";
Else cell. classname = "day ";
If (daily> 0) & (daily <= intdaysinmonth ))
{
Cell. innertext = daily;
Daily ++;
} Else
{
Cell. classname = "calendartd ";
Cell. innertext = "";
}
}
Document. All. year. value = year;
Document. All. Month. value = month + 1;
}
Function submonth ()
{
If (month-1) <0)
{
Month = 11;
Year = year-1;
} Else
{
Month = month-1;
}
Calendar ();
}
Function addmonth ()
{
If (month + 1)> 11)
{
Month = 0;
Year = year + 1;
} Else
{
Month = month + 1;
}
Calendar ();
}
Function setdate ()
{
If (document. All. Month. value <1 | document. All. Month. value> 12)
{
Alert ("the validity period of the month is between 1 and 12! ");
Return;
}
Year = math. Ceil (document. All. year. value );
Month = math. Ceil (document. All. Month. Value-1 );
Calendar ();
}
</SCRIPT>
<SCRIPT>
Function buttonover ()
{
VaR OBJ = Window. event. srcelement;
Obj.runtimestyle.css text = "background-color: # ffffff ";
// Obj. classname = "hover ";
}
Function buttonout ()
{
VaR OBJ = Window. event. srcelement;
Extends extends settimeout(function(){{obj.runtimestyle.css text = "" ;}, 300 );
}
</SCRIPT>
<Style>
Input {font-family: verdana; font-size: 9pt; text-Decoration: none; Background-color: # ffffff; Height: 20px; Border: 1px solid #666666; color: #000000 ;}
. Calendar {font-family: verdana; text-Decoration: none; width: 170; Background-color: # c0d0e8; font-size: 9pt; Border: 0px dotted #1c6fa5 ;}
. Calendartd {font-family: verdana; font-size: 7pt; color: #000000; Background-color: # f6f6f6; Height: 20px; width: 11%; text-align: center ;}
. Title {font-family: verdana; font-size: 11pt; font-weight: normal; Height: 24px; text-align: center; color: #333333; text-Decoration: none; Background-color: # a4b9d7; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-bottom-style: 1px; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999 ;}
. Day {font-family: verdana; font-size: 7pt; color: #243f65; Background-color: # e5e9f2; Height: 20px; width: 11%; text-align: center ;}
. Daysat {font-family: verdana; font-size: 7pt; color: # ff0000; text-Decoration: none; Background-color: # e5e9f2; text-align: center; height: 18px; width: 12% ;}
. Daysun {font-family: verdana; font-size: 7pt; color: # ff0000; text-Decoration: none; Background-color: # e5e9f2; text-align: center; height: 18px; width: 12% ;}
. Daynow {font-family: verdana; font-size: 7pt; font-weight: bold; color: #000000; Background-color: # ffffff; Height: 20px; text-align: center ;}
. Daytitle {font-family: verdana; font-size: 9pt; color: #000000; Background-color: # c0d0e8; Height: 20px; width: 11%; text-align: center ;}
. Daysattitle {font-family: verdana; font-size: 9pt; color: # ff0000; text-Decoration: none; Background-color: # c0d0e8; text-align: center; height: 20px; width: 12% ;}
. Daysuntitle {font-family: verdana; font-size: 9pt; color: # ff0000; text-Decoration: none; Background-color: # c0d0e8; text-align: center; height: 20px; width: 12% ;}
. Daybutton {font-family: webdings; font-size: 9pt; font-weight: bold; color: #243f65; cursor: hand; text-Decoration: none ;}
</Style>
<Table border = "0" cellpadding = "0" cellspacing = "1" class = "calendar" id = "caltable">
<Thead>
<Tr align = "center" valign = "Middle">
<TD colspan = "7" class = "title">
<A href = "javascript: submonth (); "Title =" last month "class =" daybutton "> 3 </a> <input name =" year "type =" text "size =" 4 "maxlength =" 4" onkeydown = "If (event. keycode = 13) {setdate ()} "onkeyup =" this. value = This. value. replace (/[^ 0-9]/g, '')" onpaste = "this. value = This. value. replace (/[^ 0-9]/g ,'') "> year <input name =" month "type =" text "size =" 1 "maxlength =" 2 "onkeydown =" If (event. keycode = 13) {setdate ()} "onkeyup =" this. value = This. value. replace (/[^ 0-9]/g, '')" onpaste = "this. value = This. value. replace (/[^ 0-9]/g, '')"> month <a href = "javascript: addmonth (); "Title =" Next Month "class =" daybutton "> 4 </a>
</TD>
</Tr>
<Tr align = "center" valign = "Middle">
<Script language = "JavaScript">
Document. Write ("<TD class = daysuntitle id = diary>" + days [0] + "</TD> ");
For (VAR intloop = 1; intloop <days. Length-1; intloop ++)
Document. Write ("<TD class = daytitle id = diary>" + days [intloop] + "</TD> ");
Document. Write ("<TD class = daysattitle id = diary>" + days [intloop] + "</TD> ");
</SCRIPT>
</Tr>
</Thead>
<Tbody border = 1 cellspacing = "0" cellpadding = "0" id = "calendar" align = center onclick = "getdiary ()">
<Script language = "JavaScript">
For (VAR intweeks = 0; intweeks <6; intweeks ++)
{
Document. Write ("<tr style = 'cursor: hand'> ");
For (VAR intdays = 0; intdays <days. length; intdays ++) document. write ("<TD class = calendartd onmouseover = 'buttonover (); 'onmouseout = 'buttonout (); '> </TD> ");
Document. Write ("</tr> ");
}
</SCRIPT>
</Tbody>
</Table>
<Script language = "JavaScript">
Calendar ();
</SCRIPT>