中文(简体)
<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:#000000 ;} .Calendar {字体系列:verdana;文本装饰:无;宽度:170;背景颜色:#C0D0E8;字体大小:9pt;边框:0px 点线#1C6FA5;} .CalendarTD {字体系列:verdana ;字体大小: 7pt;颜色: #000000;背景颜色:#f6f6f6;高度: 20px;宽度:11%;文本对齐:居中;} .Title {font-family: verdana;font-size: 11pt;字体粗细:正常;高度:24px;文本对齐:居中;颜色:#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"> 日历(); </脚本>