javascript calendar...

I made this javascript calendar in 2001. The javascript prints the month then draws the visual calendar beneath with today's day highlighted.

I'd make this differently if I did it today but it's interesting to look back on. The leap year bit is a bit messy and that part won't work for any leap years after 2008 (it will have missed 2012). There are quite a few aspects of programming here: arrays, functions and logic. It's all a bit long-winded and I'm sure there are neater ways to do it but it works fine. The next stage would be to work on the code and get it to be a "date" input on a form (without the images). It would also be good to get it so you can skip between different months.

The original calendar was built inside a table with each image inside a TD element, at some stage (2006 ?) it looks like I'd put it inside DIVs and lost the day headings at the top. Now, the day headings are back and it looks like it did in 2001.

I found the description, below, from an old website. As you can see I'm using the "Royal we"...

We created the javaScript calendar in 2001. It took one person 3 hours to make. Aswell as showing this month you could also see last month and next month. This calendar is a static (non-moving) example of dynamic (changes every day / month) scripting. The calendar shows this month and today's date is highlighted in white (uses the date on your PC clock).

sun mon tue wed thu fri sat