JS日历(带时间选择功能) kimsoft-jscalendar 增强版

本文介绍了一个JavaScript实现的日历插件kimsoft-jscalendar,该插件支持时间选择功能,并提供了多种语言选项。文章通过代码展示了如何创建和配置日历,包括设置年份范围、语言、日期格式等,并提供了显示、隐藏、切换月份、选择日期等操作的方法。此外,还介绍了如何在页面中使用这个插件,帮助开发者实现具有时间选择功能的日历组件。
摘要由CSDN通过智能技术生成
  1. <!--   
  2. /**  
  3.  * Calendar  
  4.  * @param   beginYear           1990  
  5.  * @param   endYear             2010  
  6.  * @param   language            0(zh_cn)|1(en_us)|2(en_en)|3(zh_tw)|4(jp)  
  7.  * @param   patternDelimiter    "-"  
  8.  * @param   date2StringPattern  "yyyy-MM-dd"  
  9.  * @param   string2DatePattern  "ymd"  
  10.  * @version V20060401  
  11.  * @version V20061217  
  12.  * @version V20080809 add to google project  
  13.  * @version V20081226 add language support for japanese   
  14.  * @version V20090104 add fix some bugs in help.html  
  15.                       use style.display replace the style.visibility  
  16.                       some enhancements and changes  
  17.  * @author  KimSoft (jinqinghua [at] gmail.com)  
  18.  * NOTE!    you can use it free, but keep the copyright please  
  19.  * IMPORTANT:you must include this script file inner html body elment   
  20.  * @see http://code.google.com/p/kimsoft-jscalendar/  
  21.  */  
  22. function Calendar(beginYear, endYear, language, patternDelimiter, date2StringPattern, string2DatePattern,showTime) {   
  23.     this.showTime=showTime;   
  24.     this.beginYear = beginYear || 1990;   
  25.     this.endYear   = endYear   || 2020;   
  26.     this.language  = language  || 0;   
  27.     this.patternDelimiter = patternDelimiter     || "-";   
  28.     this.date2StringPattern = date2StringPattern || Calendar.language["date2StringPattern"][this.language].replace(//-/g, this.patternDelimiter);   
  29.     this.string2DatePattern = string2DatePattern || Calendar.language["string2DatePattern"][this.language];   
  30.        
  31.     this.dateControl = null;   
  32.     this.panel  = this.getElementById("__calendarPanel");   
  33.     this.iframe = window.frames["__calendarIframe"];   
  34.     this.form   = null;   
  35.        
  36.     this.date = new Date();   
  37.     this.year = this.date.getFullYear();   
  38.     this.month = this.date.getMonth();   
  39.     this.house = this.date.getHours();   
  40.     this.min = this.date.getMinutes();   
  41.     this.second=this.date.getSeconds();   
  42.   
  43.     this.colors = { "bg_cur_day":"#00CC33","bg_over":"#EFEFEF","bg_out":"#FFCC00"}   
  44. };   
  45.   
  46. Calendar.language = {   
  47.     "year"   : ["/u5e74""""""/u5e74","/u5e74"],   
  48.     "months" : [   
  49.                 ["/u4e00/u6708","/u4e8c/u6708","/u4e09/u6708","/u56db/u6708","/u4e94/u6708","/u516d/u6708","/u4e03/u6708","/u516b/u6708","/u4e5d/u6708","/u5341/u6708","/u5341/u4e00/u6708","/u5341/u4e8c/u6708"],   
  50.                 ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],   
  51.                 ["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],   
  52.                 ["/u4e00/u6708","/u4e8c/u6708","/u4e09/u6708","/u56db/u6708","/u4e94/u6708","/u516d/u6708","/u4e03/u6708","/u516b/u6708","/u4e5d/u6708","/u5341/u6708","/u5341/u4e00/u6708","/u5341/u4e8c/u6708"],   
  53.                 ["/u4e00/u6708","/u4e8c/u6708","/u4e09/u6708","/u56db/u6708","/u4e94/u6708","/u516d/u6708","/u4e03/u6708","/u516b/u6708","/u4e5d/u6708","/u5341/u6708","/u5341/u4e00/u6708","/u5341/u4e8c/u6708"]                  
  54.                 ],   
  55.     "weeks"  : [["/u65e5","/u4e00","/u4e8c","/u4e09","/u56db","/u4e94","/u516d"],   
  56.                 ["Sun","Mon","Tur","Wed","Thu","Fri","Sat"],   
  57.                 ["Sun","Mon","Tur","Wed","Thu","Fri","Sat"],   
  58.                 ["/u65e5","/u4e00","/u4e8c","/u4e09","/u56db","/u4e94","/u516d"],   
  59.                 ["/u65e5","/u6708","/u706b","/u6c34","/u6728","/u91d1","/u571f"],   
  60.             ],   
  61.     "clear"  : ["/u6e05/u7a7a""Clear""Clear""/u6e05/u7a7a"
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值