中文(繁体)
<Script LANGUAGE="JavaScript"> var Months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九", 「十」、「十一」、「十二」); var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31); var days = new Array("日","一","二","三","四","五","六"); var 類臨時; var Today=new getToday(); varyear=今天.year; var 月=今天.月; var newCal;函數 getDays(月, 年) { if (1 == 月) return ((0 == 年 % 4) && (0 != (年 % 100))) ||(0 == 年 % 400) ? 29:28;否則返回daysInMonth[月]; } 函數 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(年,月,1);今天=新的getToday(); var 天 = -1; var startDay = newCal.getDay(); var endDay=getDays(newCal.getMonth(), newCal.getFullYear());每日變數 = 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].單元格[intDay]; var montemp=(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()+"-"+monttemp+"-"+daytemp+">"; if(day==daily) cell.className="DayNow";否則 if(intDay==6) cell.className = "DaySat"; else if (intDay==0) cell.className ="DaySun"; else cell.className="日"; if ((每日 > 0) && (每日 <= intDaysInMonth)) { cell.innerText = 每日;每日++; } else { cell.className="CalendarTD"; cell.innerText = ""; document.all.year.value=年份; document.all.month.value=月份+1; } 函數 subMonth() { if ((month-1)<0) { 月=11;年=年-1; } else { 月=月-1; } 日曆(); } 函數 addMonth() { if((月+1)>11) { 月=0;年=年+1; } else { 月=月+1; } 日曆(); } function setDate() { if (document.all.month.value<1||document.all.month.value>12) { alert("月份的有效範圍在1-12之間!");返回; } 年=Math.ceil(document.all.year.value);月=Math.ceil(document.all.month.value-1);日曆(); } </Script> <Script> function buttonOver() { var obj = window.event.srcElement; obj.runtimeStyle.cssText = "背景顏色:#FFFFFF"; // obj.className="懸停"; } function buttonOut() { var obj = window.event.srcElement; window.setTimeout(function(){obj.runtimeStyle.cssText = "";},300); } </Script> <樣式> 輸入 {font-family: verdana;font-size: 9pt;text-decoration: none;background-color: #FFFFFF;height: 20px;border: 1pxsolid #666666;color:#0000000 ; } .Calendar {字體系列:verdana;文字裝飾:無;寬度:170;背景顏色:#C0D0E8;字體大小:9pt;邊框:0px 點線#1C6FA5;} .CalendarTD {字體系列:verdana ;字體大小: 7pt ;顏色: #000000;背景顏色:#f6f6f6;高度: 20px;寬度:11%;文字對齊:居中;} .Title {font-family: verdana;font-size: 11pt;字體粗細:正常;高度:24pxxx ;文字對齊:居中;顏色:#333333;文字裝飾:無;背景顏色:#A4B9D7;上邊框寬度:1px;右邊框寬度:1px;邊框底部寬度:1px;邊框左寬度:1px;邊框底部樣式: 1px;邊框頂部顏色:#999999;邊框右顏色:#999999;邊框底部顏色:#999999 ;邊框左顏色:#999999;} .Day {字體系列:verdana;字體大小:7pt;顏色:#243F65;背景顏色:#E5E9F2;高度:20px;寬度:11%;文字對齊: 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 {字體系列:verdana;字體大小:7pt;字體粗細:粗體;顏色:#000000;背景顏色:#FFFFFF;高度: 20px;文字對齊:中心;} .DayTitle {字體-family: verdana;字體大小: 9pt;顏色: #000000;背景顏色: #C0D0E8;高度: 20px;寬度:11%;文字對齊: center;} .DaySatTitle {font-family: verdana;font-大小:9pt;顏色:#FF0000;文字裝飾:無;背景顏色:#C0D0E8;文字對齊:居中;高度:20px;寬度:12%;} .DaySunTitle {font-family :verdana;font-size : 9pt;顏色: #FF0000;文字裝飾: 無;背景顏色: #C0D0E8;文字對齊: 中心;高度: 20px;寬度: 12%;} .DayButton {font-family: Webdings;font -size: 9pt;字體粗細:粗體;顏色:#243F65;遊標:手;文字裝飾:無;} </Style> <table border="0" cellpadding="0" cellspacing="1" class=" Calendar" id="caltable"> <thead> <tralign="center" valign="middle"> <td colspan="7" class="Title"> <a href="javaScript:subMonth();" title="上一月" 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,'')">年<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,'')">月 <a href="JavaScript:addMonth();" title="下一月" Class="DayButton">4</a> </td> </tr> <tralign="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="日曆" 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>");文檔.write("</TR>"); } </Script> </TBODY> </TABLE> <Script LANGUAGE="JavaScript"> 日曆(); </腳本>