Click to See Complete Forum and Search --> : Need calendar help.


ilookhere2
07-07-2003, 12:37 AM
I would like to use the ANNUAL CALENDAR WITH EVENTS I found on the calendar javascripts. This calendar is for 2003 only, but I need 2004 also. It's perfect for what I need, but how do I change it into a 2004 calendar and so on?

Here is the url for it.
http://javascript.internet.com/calendars/annual-calendar-with-events.html

Thanks, ilookhere2

Gollum
07-07-2003, 04:06 AM
If you have a look through the supplied code, you'll see the following


var daycounts = [31,28,31,30,31,30,31,31,30,31,30,31]; //for leap years, remember to set february to 29 days

//2002 firstdays = [1,4,4,0,2,5,0,3,6,1,4,6];

var firstdays = [2,5,5,1,3,6,1,4,0,2,5,0];

//2004 firstdays = [3,6,7,3,5,1,3,6,2,4,0,2];


Sooo...

To make the calendar show 2004, change the firstdays variable to the 2004 version, and change the daycounts array so that February has 29 days.

Subsequent years can be done in the same way - you just need to work out which day of the week each month starts on - 0 for Monday, 1 for Tuesday, etc.

An exercise for the student could be to have the Javascript work all this out itself without needing it precalculated.

ilookhere2
07-07-2003, 04:23 AM
Thank you very much for the quick and very useful advice. I understand how it works now that you've made it easy. I sure appreciate it. Saved me lots of headaches. Thanks again.