<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 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 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()+"-"+montemp+"-"+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("月的有效范围在1-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.cssText = "background-color:#FFFFFF";
// obj.className="Hover";
}
function buttonOut()
{var obj = window.event.srcElement;window.setTimeout(function(){obj.runtimeStyle.cssText = "";},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="上一月" Class="DayButton">3</a> <input name="year" type="text" size="4" maxlength="4" οnkeydοwn="if (event.keyCode==13){setDate()}" οnkeyup="this.value=this.value.replace(/[^0-9]/g,'')"  οnpaste="this.value=this.value.replace(/[^0-9]/g,'')"> 年 <input name="month" type="text" size="1" maxlength="2" οnkeydοwn="if (event.keyCode==13){setDate()}" οnkeyup="this.value=this.value.replace(/[^0-9]/g,'')"  οnpaste="this.value=this.value.replace(/[^0-9]/g,'')"> 月 <a href="JavaScript:addMonth();" title="下一月" 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>

JavaScript日历1相关推荐

  1. 精心挑选12款优秀的 JavaScript 日历和时间选择插件

    今天这篇文章向大家分享12款精心挑选的优秀 JavaScript 日历和时间选择插件,都带有详细的使用教程和效果演示.这些插件能够帮助 Web 开发人员更快速的实现各种精美的日历和时间选择效果.同时推 ...

  2. 12款优秀的 JavaScript 日历和时间选择控件

    这些插件能够帮助  Web 开发人员更快速的实现各种精美的日历和时间选择效果. 1. The Coolest Calendar 界面非常漂亮的一款日期选择插件,有详细的使用文档,最新版本 1.5. 点 ...

  3. javascript日历插件

    javascript日历插件 原文:javascript日历插件 javascript日历插件 最近在尝试着写javascript日历插件,所以也到github上看国外人日历源码,或者国内人写的好点的 ...

  4. JavaScript日历(es5版本)

    近期在知乎上看到这么一个帖子,题主说自己JavaScript都学完了,结果老师留的作业还是不会写,就是写一个日历的插件,结果楼下一堆大牛出现了,百度的阿里的纷纷站出来发表自己的看法,有人认为简单,有人 ...

  5. 前端ui组件(1):日程排班—11个优秀JavaScript 日历插件

    日历是我们生活中重要的一部分.在当今世界,人们大多使用网络或移动日历.它们随处可见,包括在各种软件中:预订应用.旅行软件.项目管理.管理面板等. 出于多种原因,用户可能需要在网站上使用日历.用户需要容 ...

  6. Javascript日历

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD& ...

  7. 11个顶级 JavaScript 日历插件

    参考链接:https://mp.weixin.qq.com/s?__biz=MzI3NzIzMDY0NA==&mid=2247487050&idx=1&sn=e1cf66726 ...

  8. JavaScript 日历

    <!DOCTYPE html> <html> <head> <meta charset="utf8"> <style> ...

  9. JS日历控件优化(增加时分秒)

    JS日历控件优化  在今年7月份时候 写了一篇关于 "JS日历控件" 的文章 , 当时只支持 年月日 的日历控件,现在优化如下:      1. 在原基础上 支持 yyyy-mm- ...

  10. Calendars - 日历插件

    Calendars - 日历插件 1)jQuery Frontier Calendar是一个可灵活定制的月日历jQuery插件,看起来类似于Google Calendar.当在一个日期单元格中有比较多 ...

最新文章

  1. HTML5手机手写签名开发,html5手写签名
  2. Android中的约束布局
  3. wxWidgets:wxCommandLinkButton类用法
  4. linux 发送外部邮件
  5. 【转】Android M新控件之AppBarLayout,NavigationView,CoordinatorLayout,CollapsingToolbarLayout的使用...
  6. c语言做心理测试程序,求各位大神赐教!我做了一个“心理测试的答题卷”编程,总共有1...
  7. WPF 播放Flash
  8. Shell子程序结构,函数
  9. 从算法原理到应用部署!微信「扫一扫识物」 的背后技术揭秘
  10. Python合并pdf文件
  11. Win10桌面点鼠标右键一直转圈的解决方法
  12. java string转elements_Java异常堆栈信息转String
  13. 什么是数据库“存算分离”架构?
  14. Ehcache基本使用
  15. C/C++时间字符串和时间戳的相互转化
  16. 应用程序无法正常启动(0xC0000142)
  17. GMAN: A Graph Multi-Attention Network for Traffic Prediction(2020AAAI)
  18. 原来脑残一词是李时珍发明的,本草纲目中就有”脑残者无药医也“
  19. 从百度地图批量获取中国县级以上行政区划边界坐标
  20. 【51单片机Task】:led十六进制控制led灯详解、按键控制流水灯、跑马灯等任务

热门文章

  1. 微信语音转mp3 php,微信语音amr转mp3
  2. 直观理解积分-从零开始:机器学习的数学原理和算法实践
  3. 毕业论文:vrml设计的虚拟校园
  4. 《人人都是产品经理》读书笔记-2020
  5. 对应生成树的基本回路_离散数学课程复习考试试题及答案B
  6. echarts模拟迁徙城市重名问题
  7. 可视化建站cms_帝国CMS教程 | 01.系统运行环境及简介
  8. 两种方法教你将PDF转换CAD搞定!
  9. Visual Studio——使用多字节字符集与使用Unicode字符集
  10. ali p3c规则扩展-集成sonar