Free JavaScript Calendar:

Tigra Calendar is a free cross-browser JavaScript Calendar control, it improves the user experience by enabling a drop-down calendar for date fields in HTML forms.


It's public domain, even.

The biggest pain in the rear I had is that I wanted to move all of its files into a common directory, to keep the dir structure clean. To do this, I knew I needed to change the links in the <script> and stylesheet tags. I also had to change the "imgpath" attribute that belonged in the second optional parameter for the calendar display call.

It worked before I changed imgpath, but without the icon for the calendar. After I set imgpath, the icon was there, but no calendar function.

Turns out that the other params in the second array are all req'd if you use any of them. I've got the defaults in there for everything but the image path. Kinda a pain to have to slap in default values, but kinda not a pain at all to grab someone else's kewl kalendar, yo.

  <!-- calendar attaches to existing form element -->
<input type="text" name="testinput" />
<script language="JavaScript">
new tcal ({
// form name
'formname': 'testform',
// input name
'controlname': 'testinput',
}, {
'months': ["January", "February", "March", "April",
"May", "June","July", "August", "September", "October",
"November", "December"],
'weekdays': ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
'yearscroll': true,
'weekstart': 0,
'centyear': 70,
// images moved
'imgpath': 'includes/img/'
});

</script>


Very nice.

Change from the "us" to the "db" version of the file to get yyyy-mm-dd, and you're off to the php/MySQL races.

EDIT: Guess I should add the script for the top. I move all the tigra files into a folder called "calendarIncludes" and slap that in some includes folder. Eg...

<!-- link calendar files  -->
<script language="JavaScript"
src="./calendarIncludes/calendar_db.js"></script>
<link rel="stylesheet"
href="./calendarIncludes/calendar.css">

Labels: , ,