Traditional Culture Encyclopedia - Travel guide - I am urgently looking for the use of Calendar.js, the calendar plug-in of Travel Network.

I am urgently looking for the use of Calendar.js, the calendar plug-in of Travel Network.

The following are extracted from the website you gave for reference

//Calendar control container

Involved js files:

< p>1.Calendar.js Address: /js/Calendar.js

2.jquery.js (You need to open this to see, the content inside is not jQuery) Address: /sys/js/jquery. js

3.jquery.validate.check.js Address:/sys/js/jquery.validate.check.js

4.line.js (Calendar month display calling function is in this) Address:/js/line.js

5.myfocus-2.0.4.min.js Address:/js/plugin/myfocus-2.0.4.min.js

The core calling code is as follows (this function may also need to be used in conjunction with other js.

):

CreateCalendar(c, y, m, a, b,d, f,fu)

Parameter description: c: container,

y: Year,

m: Month,

a: Departure time XML,

b: Group participants,

d: Whether every day Send a group,

f: whether to display dual calendars,

fu: callback

Usage example:

1. CalendarPage('calendarcontainer ',2014,4); //Display the calendar for April and May

2.CalendarPage('calendarcontainer',2014,2); //Display the calendar for February and March

function CreateCalendar(c, y, m, a, b,d, f,fu) {//c: container, y: year, m: month, a: departure time XML, b: group participants, d: whether every day Send a group, f: whether to display dual calendars, fu: callback LC[c] = [c, y, m, a, b, d,f, fu]; var today = new Date(Date.parse(webconfig('date ').replace(/-/g, '/'))); today = new Date(today.getFullYear(),today.getMonth(),today.getDate()); if (y == 0 || m == 0) { y = today.getFullYear(); m = today.getMonth() + 1; };var dmin=Date.parse(a.first().attr('d').replace(/-/ g, '/')),dmax =Date.parse(a.last().attr('d').replace(/-/g, '/')); var i1 = 0, i2 = 0, i3 = 0, d1 = new Date(dmin), d2; today = today.DateToParse(); if (Date.parse(d1.getFullYear() + '/' + (d1.getMonth() + 1) + '/1 ') > Date.parse(new Date(y,m-1,1))) { y = d1.getFullYear(); m = d1.getMonth() + 1; } $('#' + c).html ('');//Lunar calendar//var ca=new Calendar();tmp='';for(var i=0;i<=f;i++){d1=new Date(y,m-1+i );y=d1.getFullYear();m=d1.getMonth() + 1;tmp += '

';tmp += '';tmp += ' ';tmp += ' ';tmp += ' ';tmp += ' ';tmp += ' ';tmp += ' ';tmp += ' ';tmp += ' ';var maxdays = (new Date(Date.parse(new Date(y,m,1)) - 86400000)).getDate(); //The number of days in the current month d1 = new Date(y,m-1); //The date to be displayed i1 = d1.getDay(); //The first day of this month is the day of the week for (var j = 1; j <= 6; j++) { tmp += '';for (var k = 1; k <= 7; k++) {i2 = (j - 1) * 7 + k - i1;if (i2 < 1 || i2 > maxdays) { tmp += '';} else {i3 = Date.parse(new Date(y,m-1,i2));d1=new Date(i3);//Value of lunar calendar (ll for the lunar calendar)/*var ll=ca.getlf(d1);if(ll==''){ll=ca.getsf(d1);if(ll==''){ll=ca.getst(d1) ;if(ll=='')ll=ca.getls(d1)[3];}}*/tmp+=' dmax) {tmp += '>

' + i2 + '';} else {tmp += ' week="' + (k - 1) + '" id="' + y + '-' + m + '-' + i2 + '">

' + i2 + '

< /td>';}}}tmp += '
';}tmp += '
';if(i==0){i1=Date.parse(y + '/' + m + '/1'); d1 = new Date(dmin);if(Date.parse(d1.getFullYear() + '/' + (d1.getMonth() + 1) + '/1')?';}else{tmp += '?';}}tmp+='
';tmp += '
' + y + ' Year' + m + 'Month
';tmp+='
';if(i==f){i1=Date.parse (y + '/' + m + '/1');d1 = new Date(dmax);i2=Date.parse(d1.getFullYear() + '/' + (d1.getMonth() + 1) + ' /1');if(i2>i1){d1 = new Date(y,Date.parse(new Date(y,m+1,1))>i2?m-f:m,1);tmp += '< a class="next" href="javascript:;" onclick="CalendarPage(\'' + c + '\',' + d1.getFullYear() + ',' + (d1.getMonth() + 1) + ');" title="next month">?';}else{tmp += '?< /a>';}}tmp += '
SundayMondayTuesdayWednesday< /th>';tmp += ' ThursdayFridaySaturday
';} $('#' + c).append(tmp); var obj,crowdid=0 ;for(var i in currentLP.crowd){if(crowdid==0)crowdid=currentLP.crowd[i].id;}a.each(function(){obj=$('#'+$(this) .attr('d'));var j={d:$(this).attr('d'),n:$(this).attr('n'),c:[]},k=0 ;$(this).children('c').each(function(i){if(crowdid==$(this).attr('i'))k=i;j.c.push({i:$(this ).attr('i'),n:$(this).attr('n'),p:$(this).attr('p')});});obj.data('i', j).attr('v',1).append('

'+(j.c[k].p==-1?'Telephone inquiry':'?'+j.c [k].p)+'

remainder'+(j.n==-1||j.n>9?'>9 ':''+j.n+'')+'

');}); if ($.isFunction(fu)){$('#' + c +' td[v]').click(function (){ fu(this); }).hover( function () {$(this).addClass("hover"); }, function () {$ (this).removeClass("hover"); });}}