|
Displaying Dates: Smart Calendar Components
Credit: Soft
Complex,
Description
Putting in time and date calendar control greatly simplifies date entry
on forms. ..We examine a second componentthat does not have so many restrictions
associated with working with other scripts. As well, the Tigra calendar
control offers, a time stamp and some flexible year and month scrolling
options.
Key features and JavaScript elements
Uses CSS and pop-up windows to build up calendar . The calendar components
automatically fill in their associated form fields and the scrolling
options are icon triggered. Tigra has a couple of options for scrolling
either/or years and months.
Calendar Setup: To
use the calendar component you will need 2 subdirectories ( images
and javascript ) on your site where you will put the following files:
web page foler gets calendar.html
images folder gets tigracal.gif (I had to rename cal.gif due
to name clash), next.gif, next_year.gif,
prev.gif, prev_year.gif
javascript gets calendar2.js
Next place the following line in the <head> block
of your html file:
<script language="JavaScript" src="javascript/calendar2.js"
Next mke sure the form and input fields you want a calendar popup for
have unique names. Then next to each input field requiring a calendar
popup, add the following code:
<a href="javascript:cal5.popup();"><img src=images/tigracal.gif
width="16" height="16" border="0" alt="Click
Here to Pick up the date"></a>
Note that the icon is surrounded with an <a> tag which has a Javascript
call on a routine which you will define as the last step in creating
this popup calendar. To define the specific pop call with the exact parameetrs
desired, go to the the end </form> tag and insert the following code:
<script language="JavaScript">
var cal5 = new calendar2(document.forms['tstest'].elements['input5']);
cal5.year_scroll = true; // year scrolling is enabled here
cal5.time_comp = false; //time display is disable
<script>
Now this Javascript must come right after the </form> closing
tag. We tried moving it elsewhere and immediately broke the application.
So without further to do, try the popup calendar.
|