需要一个能显示整年的日历插件,求指点

艾特九哥 2015-03-17 10:38:46
项目中有一个功能,需要显示一整年的日历,并且能对每一天有事件操作,求问有做过的高手吗,求指点,谢谢
...全文
273 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ASDFX110 2015-03-19
  • 打赏
  • 举报
回复
上面 每个月要减一
ASDFX110 2015-03-19
  • 打赏
  • 举报
回复
2015年全部的日历,要什么风格自己改样式就可以了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script language="javascript" src="jquery.js"></script>
<style>
*{ margin:0; padding:0}
.c1{ height:250px; padding-top:15px;}
.c2{border:#ccc solid 1px; width:292px;background:#fff; float:left; margin-left:30px;}

.cad_time{ height:40px; line-height:40px; text-align:center; padding:0 10px;}
.cad_time span{ font-family:Verdana, Arial, Helvetica, sans-serif; font-size:16px; color:#666;}
.cad_list{ border-top:#eee solid 1px;border-left:#eee solid 1px; font-size:12px; width:100%; border-collapse:collapse}
.cad_list thead tr th{ border-right:#eee solid 1px; border-bottom:#eee solid 1px; color:#666; height:30px; line-height:30px; background:#fcfcfc; font-size:14px; }
.cad_list tbody tr td{ border-right:#eee solid 1px; border-bottom:#eee solid 1px;color:#666; height:28px; line-height:28px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; text-align:center }
.ct_red{ font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF8800; font-size:14px;}
.cad_list thead tr th.last,.cad_list tbody tr td.last{ border-right:0}
</style>
<script>
var Calendar={
	daysInMonth:[31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31],//定义每月的天数
	getDays:function(month, year){//校正2月天数
		var _this=this;
		if (1 == month) 
			return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28;
  		else 
			return _this.daysInMonth[month];
	},
	Calendar:function(year,month){//创建日历
		var _this=this,
			newCal = new Date(year,month,1),
			day = -1,
			startDay = newCal.getDay(),
			endDay=_this.getDays(newCal.getMonth(), newCal.getFullYear()),
			str="<tr>",n=0;

				for(var i=0;i<startDay;i++){
					str+="<td class='kb'></td>"	
				}
			for( var i=0;i<endDay;i++){
				if(((i+startDay)%7)==0 && i!=0 &&  i!=endDay){
					str+="</tr><tr>";
					n++
				}
				str+="<td>"+(i+1)+"</td>"	
				
			}
			if(((endDay+startDay)%7)==0){
				str+="</tr>"
			}else{
				n++
				for(var t=0;t<((n*7)-(endDay+startDay));t++){
					str+="<td class='cal_kb'></td>"	
				}
				str+="</tr>"	
			}
			return str
	}	
}
</script>
</head>

<body>
<div class="c1">

<div class="c2">
<div class="cad_time">
<span>2015 - 01</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,1))</script></tbody>
</table>
</div>

<div class="c2">
<div class="cad_time">
<span>2015 - 02</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,2))</script></tbody>
</table>
</div>


<div class="c2">
<div class="cad_time">
<span>2015 - 03</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,3))</script></tbody>
</table>
</div>


<div class="c2">
<div class="cad_time">
<span>2015 - 04</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,4))</script></tbody>
</table>
</div>

</div>

<div class="c1">

<div class="c2">
<div class="cad_time">
<span>2015 - 05</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,5))</script></tbody>
</table>
</div>

<div class="c2">
<div class="cad_time">
<span>2015 - 06</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,6))</script></tbody>
</table>
</div>


<div class="c2">
<div class="cad_time">
<span>2015 - 07</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,7))</script></tbody>
</table>
</div>


<div class="c2">
<div class="cad_time">
<span>2015 - 08</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,8))</script></tbody>
</table>
</div>

</div>

<div class="c1">

<div class="c2">
<div class="cad_time">
<span>2015 - 09</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,9))</script></tbody>
</table>
</div>

<div class="c2">
<div class="cad_time">
<span>2015 - 10</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,10))</script></tbody>
</table>
</div>


<div class="c2">
<div class="cad_time">
<span>2015 - 11</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,11))</script></tbody>
</table>
</div>


<div class="c2">
<div class="cad_time">
<span>2015 - 12</span>
</div>
<table class="cad_list">
<thead><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th class="last">六</th></tr></thead>
<tbody><script>document.write(Calendar.Calendar(2015,12))</script></tbody>
</table>
</div>

</div>

</body>
</html>
ASDFX110 2015-03-19
  • 打赏
  • 举报
回复
我自己写过一个签到的,不知道符不符合

  • 打赏
  • 举报
回复
自己写一个呗,然后写完后共享出来
艾特九哥 2015-03-17
  • 打赏
  • 举报
回复
引用 2 楼 kongwei521 的回复:
jQuery Verbose Calendar 可以显示整年的。已验证。 http://www.gbtags.com/technology/jquerynews/20120519jquery-verbose-calendar/
看过这个,这个不太符合要求,我要的是跟fullcalendar类似的风格的,谢谢你了
艾特九哥 2015-03-17
  • 打赏
  • 举报
回复
引用 1 楼 starfd 的回复:
自己写一个吧,应该没有哪个现成的控件会这样,就算万年历貌似也是一个月一个月显示的
先看看前辈高手们有写过的没,有些过的话就不用再重复写了,没有的话,只能自己写了,嘿嘿
蝶恋花雨 2015-03-17
  • 打赏
  • 举报
回复
jQuery Verbose Calendar 可以显示整年的。已验证。 http://www.gbtags.com/technology/jquerynews/20120519jquery-verbose-calendar/
  • 打赏
  • 举报
回复
自己写一个吧,应该没有哪个现成的控件会这样,就算万年历貌似也是一个月一个月显示的

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧