第11款插件:jCal显示日历插件

日历插件jCal提供了一个简单易用的方法来实现表单中日期的输入和选择功能,适用于多种浏览器。本文详细介绍了如何引用、配置插件,并通过实例展示了其使用方法及效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

描述:日历插件jCal用于需要输入日期的表单文本框。

兼容浏览器:IE浏览器/Firefox/Google Chrome

官方链接: http://www.overset.com/2008/05/1 ... cker-jquery-plugin/

JS下载: http://ijquery.360sites.cn/js/jquery.jCal.min.js

预览:  http://ijquery.360sites.cn/demo/jCal

打包下载: http://ijquery.360sites.cn/demo/jCal/jCal.zip

参数说明:

  1.     $('#calOne').jCal({
  2.     day: new Date(), // 初始日期设置,一般是当前的,所以填写为new Date
  3.     days:1,    // 当你鼠标移动到日期控件上默认所选择的日期数
  4.     showMonths: 1, // 日期控件的个数,如果你填写2,那么将会显示相邻二个月的日期
  5.     monthSelect:false, // 是否允许月份选择
  6.     dCheck:function (day) { return true; }, // 你可以设置一些日期不可选(参考实例)
  7.     callback: function (day, days) { return true; }, // 点击日期时候的回调函数(参考实例)
  8.     selectedBG: 'rgb(0, 143, 214)',   // 日期被选择后的背景颜色(貌似无效)
  9.     defaultBG:'rgb(255, 255, 255)', // 日期没有被选择时的背景颜色(貌似无效)
  10.     dayOffset:0,   // 意味着日期排序从星期日开始,1意味着从星期一
  11.     forceWeek:false, // true=force selection at start of week, false=select days out from selected day
  12.     dow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'], // 设置日期表格行头,是转化成中文的关键
  13.     ml: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],//月份的名称,可以转化为中文
  14.     ms:    ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']//月份的简写
  15.     })
复制代码
图片展示:


JS引用代码:
  1. <script type="text/javascript" charset="utf-8" src="http://ijquery.360sites.cn/js/jquery-1.4.2.min.js"></script>
  2. <script type="text/javascript" charset="utf-8" src="http://ijquery.360sites.cn/js/jquery.animate.clip.js"></script>
  3. <script type="text/javascript" charset="utf-8" src="http://ijquery.360sites.cn/js/jquery.jCal.min.js"></script>
  4. <script>
  5.         $(function () {
  6.                 $('#calendar').jCal({
  7.                         day: new Date(),
  8.                         days: 1,
  9.                         showMonths: 2,
  10.                         monthSelect: true,
  11.                         dow: ['日', '一', '二', '三', '四', '五', '六'],
  12.                         ml: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  13.                         callback: function (day, days) {
  14.                                 $('#result').html(day.getFullYear() + '/' + (day.getMonth() + 1) +'/'+ day.getDate());
  15.                         }
  16.                 });
  17.         });
  18. </script>
复制代码
HTML代码:
  1. <!--显示日历-->
  2.                                 <div id="calendar"></div>
  3.                                 <!--显示选择日历的结果-->
  4.                                 <div id="result"></div>
复制代码
CSS代码:
  1. <link rel="stylesheet" type="text/css" href="http://ijquery.360sites.cn/js/jquery.jCal.css" media="all" />
复制代码
这里用到的图片:
http://ijquery.360sites.cn/js/jquery.jCal.zip  点击进行打包下载

CSS源代码如下:
  1. /* default dimensions and justification for each month including title */
  2. .jCal {
  3.         /* each day width + border-left + border-right */
  4.         width:224px;
  5.         height:21px;
  6.         text-align:center;
  7.         vertical-align:top;
  8. }
  9. /* default dimensions and justification for each month not including title */
  10. .jCalMo {
  11.         width:224px;                /* each day width + border-left + border-right */
  12.         float:left;
  13.         overflow:visible;
  14.         height:100%;
  15.         padding-right:2px;
  16.         padding-left:2px;
  17.         white-space:nowrap;
  18. }
  19. /* top month display block - i.e. January */
  20. .jCal .month, .jCal .monthSelect, .jCal .monthName, .jCal .monthYear {
  21.         line-height:16px;
  22.         height:16px;
  23.         text-align:center;
  24.         vertical-align:bottom;
  25.         font-family:Tahoma;
  26.         font-size:8pt;
  27.         color:#000000;
  28.         cursor:pointer;
  29.         float:left;
  30. }
  31. /* month name per calendar style - includes left/right padding and alignment */
  32. .jCal .monthName {
  33.         padding-left:2px;
  34.         padding-right:2px; 
  35.         text-align:right;
  36. }
  37. /* year per calendar style - includes left/right padding and alignment */
  38. .jCal .monthYear {
  39.         float:right;
  40.         padding-left:2px;
  41.         padding-right:2px;
  42.         text-align:left;
  43. }
  44. /* hilight style for new month combobox pulldown for hover */
  45. .jCal .monthSelect {
  46.         background:#EEE url(eeGrad2.gif) bottom repeat-x;
  47. }
  48. /* do not edit - this enables the new month combobox selector */
  49. .jCal .monthSelector {
  50.         position:absolute;
  51. }
  52. /* do not edit - this enables the new month combobox selector "shadow" for capturing auto-hide */
  53. .jCal .monthSelectorShadow {
  54.         position:absolute;
  55.         background:#808080;
  56.         padding:0px;
  57. }
  58. /* this is the hover for the month name */
  59. .jCal .monthNameHover {
  60.         background:#EDEDED url(double-arrow-vert.gif) center left no-repeat;
  61.         color:#808080;
  62. }
  63. /* this is the hover for the year */
  64. .jCal .monthYearHover {
  65.         background:#EDEDED url(double-arrow-vert.gif) center right no-repeat;
  66.         color:#808080;
  67. }
  68. /* this is the hover for the new month or year hover in the new combobox selection */
  69. .jCal .monthSelectHover {
  70.         background:#069;
  71.         color:#FFF;
  72. }
  73. /* day block dimensions and style - for all day blocks */
  74. .jCalMo .dow, .jCalMo .day, .jCalMo .pday, .jCalMo .aday, .jCalMo .overDay, .jCalMo .invday, .jCalMo .selectedDay {
  75.         width:30px;
  76.         font-family:Tahoma;
  77.         font-size:8pt;
  78.         color:#000000;
  79.         border-right:1px solid #CCC;
  80.         border-bottom:1px solid #CCC;
  81.         border-left:1px solid #EEE;
  82.         text-align:center;
  83.         cursor:default;
  84.         float:left;
  85. }
  86. /* day of week header specific style */
  87. .jCalMo .dow {
  88.         background:#EEE url(eeGrad.gif) bottom repeat-x;
  89.         border-bottom:0px;
  90. }
  91. /* actual calendar day default style */
  92. .jCalMo .day, .jCalMo .invday {
  93.         height:30px;
  94.         text-align:center;
  95. }
  96. /* selectable calendar day specific style */
  97. .jCalMo .day {
  98.         cursor:pointer;
  99.         background:#FFF;
  100. }
  101. /* blacked-out calendar day specific style */
  102. .jCalMo .invday {
  103.         color:#808080;
  104.         background:#eeeeee;
  105.         text-decoration:line-through;
  106. }
  107. /* previous and subsequent months calendar day specific style */
  108. .jCalMo .pday, .jCalMo .aday {
  109.         height:30px;
  110.         background:#e3e3e3;
  111.         color:#CCC;
  112. }
  113. /* selected day */
  114. .jCalMo .selectedDay {
  115.         color:#FFF;
  116.         /* must use rgb() syntax for jquery.color.js compliance */
  117.         background:rgb(0, 143, 214);
  118. }
  119. /* mouseover hilighted selectable day */
  120. .jCalMo .overDay {
  121.         color:#FFF;
  122.         /* must use rgb() syntax for jquery.color.js compliance */
  123.         background:rgb(0, 102, 153);
  124. }
  125. /* left month navigation button - no need to change */
  126. .jCal .left {
  127.         background:url(_left.gif) center center no-repeat;
  128.         width:16px;
  129.         height:16px;
  130.         vertical-align:middle;
  131.         cursor:pointer;
  132.         float:left;
  133. }
  134. /* right month navigation button - no need to change */
  135. .jCal .right {
  136.         background:url(_right.gif) center center no-repeat;
  137.         width:16px;
  138.         height:16px;
  139.         vertical-align:middle;
  140.         cursor:pointer;
  141.         float:right;
  142. }
  143. /* no need to change - this is for carousel opacity */
  144. .jCalMask, .jCalMove {
  145.         position:absolute;
  146.         overflow:hidden;
  147. }
复制代码

[转] http://ijquery.360sites.cn/forum.php?mod=viewthread&tid=11

一、插件名称:动易博客日历插件(20080416) 二、适用版本:动易 PowerEasy SiteWeaver 6.5 系列 三、插件作用:产生一个带搜索链接的日历 四、插件特点:  1、在生成新文章网页时就会自动生成对应当月的日历JS文件。  2、对于一篇文章来说,基本上只需要查询一次数据就可以生成对应的日历JS文件,大大节省服务器资源。  3、所有日历JS文件都动态自动生成。 五、安装方法: 1、将解压后的Calendar目录复制到您网站的根目录下,然后打开 CreateCalendar.asp 修改第4行和第5行的变量设置,将它们修改成你的设置信息 BlogChannelID = "1" '博客频道的频道ID ShowpageID = "1" '你所添加的自定义页面ID FontSize = "10pt" '日历字体大小 CalendarWidth = "98%" '日历宽度 TodayBackgroundColor = "#99ff00" '当天日期背景色 2、在网页模板(除自定义页模板外)适当位置插入以下代码: <Div id="BlogCalendar" align="center"><iframe src="/Calendar/ShowCalendar.asp?ShowDate={$pageinput(0)}" frameborder="0" scrolling="no" width="180" height="168"></iframe></Div> **注意**:如果启用了子域名功能,那这里的调用一定要是主站的完整网址。如主站域名是 www.drlzf.com ,子域名为 blog.drlzf.com ,那么,在子域名 blog.drlzf.com 下调用动易博客日历插件时,应该使用这样的形式:<Div id="BlogCalendar" align="center"><iframe src="http://www.drlzf.com/Calendar/ShowCalendar.asp?ShowDate={$pageinput(0)}" frameborder="0" scrolling="no" width="180" height="168"></iframe></Div> 3、打开 admin\Admin_Article.asp 进行以下两项修改:   3.1、查找以下代码: If Status = 3 And PE_CLng(Trim(Request("ReceiveType"))) = 0 And UseCreateHTML > 0 And ObjInstalled_FSO = True And Trim(Request.Form("CreateImmediate")) = "Yes" Then Response.Write "<br><iframe id='CreateArticle' width='100%' height='210' frameborder='0' src='Admin_CreateArticle.asp?ChannelID=" & ChannelID & "&Action=CreateArticle2&ClassID=" & ClassID & "&SpecialID=" & SpecialID & "&ArticleID=" & ArticleID & "&ShowBack=No'></iframe>" End If 在其下一行添加以下代码:   Call CreateCalendarJS(ArticleID)   3.2 查找以下代码: <!--#include file="../Include/PowerEasy.XmlHttp.asp"--> 在其下一行添加以下代码: <!--#include file="../Calendar/CreateCalendar.asp"--> 4、自定义动态页面和动态函数标签代码如下: 4.1、自定义函数标签:{$MY_日期搜索({$pageinput(0)})} 参数说明:查询日期 查询语句:select ArticleID,Title,Author,Hits,UpdateTime,Content from PE_Article where ChannelID=1002 and Status=3 and Deleted={$PE_False} and DateDiff("d",UpdateTime,'{input(0)}')=0 Order by ArticleID desc 标签内容: {Loop}{Infobegin} <div style="CLEAR: both"> <table cellSpacing=2 cellPadding=0 width="100%"> <tr> <td> <div id=blog_title><A href="{$InstallDir}{$Field(0,GetUrl,Article,1)}" target=_blank>{$Field(1,Text,60,2,1)}</A> {$Field(4,Time,0,{year}年{month}月{day}日)} </div></td> </tr> </table> <table style="MARGIN-TOP: 4px; MARGIN-BOTTOM: 10px" width="100%" border=0> <tr> <td style="COLOR: #000"><FONT color=#000000>{$Field(5,Text,300,2,0)}</FONT></td> </tr> <tr> <td align=right> <P align=left> <HR style="BORDER-RIGHT: dotted; BORDER-TOP: dotted; BORDER-LEFT: dotted; WIDTH: 604px; COLOR: #a0a0a0; BORDER-BOTTOM: dotted; HEIGHT: 1px" noShade SIZE=1> Posted By<FONT color=#91d52b> </FONT>{$Field(2,Text,0,2,1)} <A href="{$InstallDir}{$Field(0,GetUrl,Article,1)}" target=_blank><STRONG>阅读全文>></STRONG></A> 阅读次数:{$Field(3,Num,0,0)} </td> </tr> </table> <P align=left><A href="{$InstallDir}{$Field(0,GetUrl,Article,1)}" target=_blank><STRONG></STRONG></A></P></div>{Infoend}{/Loop} 4.2、自定义动态页面: 4.2.1 参数声明:Data|1|true|2006-08-01 4.2.2 页面内容: 4.2.2.1 在页面内容模板中适当位置添加 {$MY_日期搜索({$pageinput(0)})} 标签来显示搜索到的博文结果 4.2.2.2 在页面内容模板中显示日历的地方插入以下代码: <Div id="BlogCalendar" align="center"><iframe src="/Calendar/ShowCalendar.asp?ToDay={$pageinput(0)}" frameborder="0" scrolling="no" width="180" height="168"></iframe></Div> 六、演示网址:http://www.drlzf.cn 如果大家对于这个插件有什么疑问的,欢迎与我联系,我的QQ:22926416
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值