由于项目的需要 ,最近研究了一下FullCalendar ,具体的FullCalendar的详细内容请参考官网http://arshaw.com/fullcalendar/。 在此推荐一篇关于FullCalendar API的中文翻译
http://www.cnblogs.com/mycoding/archive/2011/05/20/2052152.html,对于英文不是很好的同学是个不错的参考资料。
不多说了直接上代码,代码没有整理和优化。
1,首先引入相关的js以及css文件
<link href="../ad/css/fullcalendar/fullcalendar.css" rel='stylesheet' />
<link href="../ad/css/fullcalendar/fullcalendar.print.css" rel='stylesheet' media='print' />
<script src="../ad/script/fullcalendar/jquery.min.js"></script>
<script src="../ad/script/fullcalendar/jquery-ui.custom.min.js"></script>
<script src="../ad/script/fullcalendar/fullcalendar.min.js"></script>
2,FullCalendar需要渲染的Dom元素
<div id='calendar'></div>
3,相关处理的js
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
firstDay: 1,
buttonText: {
day: '日',
week: '周',
month: '月'
},
titleFormat:'yyyy年-MM月',
monthNames: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
dayNames: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
dragOpacity:{
agenda:.5, //对于agenda试图
'':.7 //其他视图
},
eventDrop: function(event,dayDelta,minuteDelta,allDay,revertFunc, jsEvent, ui, view) {
_eventDropOrResize(event,dayDelta,minuteDelta,allDay,revertFunc, jsEvent, ui, view);
},
eventResize: function(event,dayDelta,minuteDelta,allDay,revertFunc, jsEvent, ui, view){
_eventDropOrResize(event,dayDelta,minuteDelta,allDay,revertFunc, jsEvent, ui, view);
},
dayClick:function( date, allDay, jsEvent, view ){
openPage(this ,date, allDay, jsEvent, view);
},
eventClick:function(event, jsEvent, view ){
delPreWebAdv(event, jsEvent, view );
},
eventSources:[{
url: "../../adv/preWebAdv/preWebAdv.do?action=getPreWebAdvs",
type: "post",
data: {
edition: edition,
kanwu: kanwu,
skanqi: skanqi,
ekanqi: ekanqi
},
error: function() {
alert('获取预约网站广告失败!');
},
// color: 'yellow',
textColor: "black"
}]
});