日历-指定日期的新闻 程序员文章站 2023-12-10 20:56:40 var months = new array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二"... 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 "; 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 function submonth() { if ((month-1) function addmonth() { if((month+1)>11) { month=0; year=year+1; } else { month=month+1; } calendar(); } function setdate() { if (document.all.month.value12) { alert("月的有效范围在1-12之间!"); return; } year=math.ceil(document.all.year.value); month=math.ceil(document.all.month.value-1); calendar(); } function buttonout() { var obj = window.event.srcelement; window.settimeout(function(){obj.runtimestyle.csstext = "";},300); } .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;} 3 年 月 4 [ctrl+a 全选 注:如需引入外部js需刷新才能执行] 上一篇: 索尼PS4/PS Vita游戏机正式入华 PS4售2899元 下一篇: 推荐阅读 日历-指定日期的新闻 java生成指定范围的随机日期 mssql中获取指定日期所在月份的第一天的代码 使用iframe作为日历的载体,不再被select和flash等控件挡住的日期输入框 JavaScript中用getDate()方法返回指定日期的教程 Mysql指定日期区间的提取方法 Python根据指定日期计算后n天,前n天是哪一天的方法 python+pandas生成指定日期和重采样的方法 用ASP实现距指定日期的倒记时程序源码 如何使用PHP获取指定日期所在月的开始日期与结束日期