1 <?xml version=
"1.0" encoding=
"utf-8"?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 <!-- $Id: index.html,v 1.10 2004/02/06 18:53:09 mishoo Exp $ -->
7 <meta http-equiv=
"content-type" content=
"text/xml; charset=utf-8" />
8 <title>The Coolest DHTML Calendar - Online Demo
</title>
9 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-blue.css" title=
"winter" />
10 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-blue2.css" title=
"blue" />
11 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-brown.css" title=
"summer" />
12 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-green.css" title=
"green" />
13 <link rel=
"stylesheet" type=
"text/css" media=
"all" href=
"calendar-win2k-1.css" title=
"win2k-1" />
14 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-win2k-2.css" title=
"win2k-2" />
15 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-win2k-cold-1.css" title=
"win2k-cold-1" />
16 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-win2k-cold-2.css" title=
"win2k-cold-2" />
17 <link rel=
"alternate stylesheet" type=
"text/css" media=
"all" href=
"calendar-system.css" title=
"system" />
19 <!-- import the calendar script -->
20 <script type=
"text/javascript" src=
"calendar.js"></script>
22 <!-- import the language module -->
23 <script type=
"text/javascript" src=
"lang/calendar-en.js"></script>
25 <!-- other languages might be available in the lang directory; please check
26 your distribution archive. -->
28 <!-- helper script that uses the calendar -->
29 <script type=
"text/javascript">
32 // code to change the active stylesheet
33 function setActiveStyleSheet(link, title) {
35 for(i=
0; (a = document.getElementsByTagName(
"link")[i]); i++) {
36 if(a.getAttribute(
"rel").indexOf(
"style") != -
1 && a.getAttribute(
"title")) {
38 if(a.getAttribute(
"title") == title) a.disabled = false;
41 if (oldLink) oldLink.style.fontWeight = 'normal';
43 link.style.fontWeight = 'bold';
47 // This function gets called when the end-user clicks on some date.
48 function selected(cal, date) {
49 cal.sel.value = date; // just update the date in the input field.
50 if (cal.dateClicked && (cal.sel.id ==
"sel1" || cal.sel.id ==
"sel3"))
51 // if we add this call we close the calendar on single-click.
52 // just to exemplify both cases, we are using this only for the
1st
53 // and the
3rd field, while
2nd and
4th will still require double-click.
54 cal.callCloseHandler();
57 // And this gets called when the end-user clicks on the _selected_ date,
58 // or clicks on the
"Close" button. It just hides the calendar without
60 function closeHandler(cal) {
61 cal.hide(); // hide the calendar
66 // This function shows the calendar under the element having the given id.
67 // It takes care of catching
"mousedown" signals on document and hiding the
68 // calendar if the click was outside.
69 function showCalendar(id, format, showsTime, showsOtherMonths) {
70 var el = document.getElementById(id);
71 if (calendar != null) {
72 // we already have some calendar created
73 calendar.hide(); // so we hide it first.
75 // first-time call, create the calendar.
76 var cal = new Calendar(true, null, selected, closeHandler);
77 // uncomment the following line to hide the week numbers
78 // cal.weekNumbers = false;
79 if (typeof showsTime ==
"string") {
81 cal.time24 = (showsTime ==
"24");
83 if (showsOtherMonths) {
84 cal.showsOtherMonths = true;
86 calendar = cal; // remember it in the global var
87 cal.setRange(
1900,
2070); // min/max year allowed.
90 calendar.setDateFormat(format); // set the specified date format
91 calendar.parseDate(el.value); // try to parse the text in field
92 calendar.sel = el; // inform it what input field we use
94 // the reference element that we pass to showAtElement is the button that
95 // triggers the calendar. In this example we align the calendar bottom-right
97 calendar.showAtElement(el.nextSibling,
"Br"); // show the calendar
102 var MINUTE =
60 *
1000;
103 var HOUR =
60 * MINUTE;
107 // If this handler returns true then the
"date" given as
108 // parameter will be disabled. In this example we enable
109 // only days within a range of
10 days from the current
111 // You can use the functions date.getFullYear() -- returns the year
112 // as
4 digit number, date.getMonth() -- returns the month as
0.
.11,
113 // and date.getDate() -- returns the date of the month as
1.
.31, to
114 // make heavy calculations here. However, beware that this function
115 // should be very fast, as it is called for each day in a month when
116 // the calendar is (re)constructed.
117 function isDisabled(date) {
118 var today = new Date();
119 return (Math.abs(date.getTime() - today.getTime()) / DAY)
> 10;
122 function flatSelected(cal, date) {
123 var el = document.getElementById(
"preview");
127 function showFlatCalendar() {
128 var parent = document.getElementById(
"display");
130 // construct a calendar giving only the
"selected" handler.
131 var cal = new Calendar(true, null, flatSelected);
134 cal.weekNumbers = false;
136 // We want some dates to be disabled; see function isDisabled above
137 cal.setDisabledHandler(isDisabled);
138 cal.setDateFormat(
"%A, %B %e");
140 // this call must be the last as it might use data initialized above; if
141 // we specify a parent, as opposite to the
"showCalendar" function above,
142 // then we create a flat calendar -- not popup. Hidden, though, but...
145 // ... we can show it here.
150 <style type=
"text/css">
151 .ex { font-weight: bold; background: #fed; color: #
080 }
152 .help { color: #
080; font-style: italic; }
153 body { background: #fea; font:
10pt tahoma,verdana,sans-serif; }
154 table { font:
13px verdana,tahoma,sans-serif; }
156 a:visited { color: #
00f; }
157 a:hover { color: #f00; background: #fefaf0; }
158 a:active { color: #
08f; }
159 .key { border:
1px solid #
000; background: #fff; color: #
008;
160 padding:
0px
5px; cursor: default; font-size:
80%; }
164 <body onload=
"showFlatCalendar()">
166 <h2><a href=
"http://dynarch.com/mishoo/calendar.epl"
167 title=
"Visit the project website">jscalendar
</a>-
0.9.6
168 "Keep cool but don't freeze"</h2>
171 <div style=
"float: right; border: 1px solid #b87; padding: 2px; font-size: 90%; background: #ffb;">
173 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'winter');">winter
</a>
175 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'blue');">blue
</a>
177 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'summer');">summer
</a>
179 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'green');">green
</a>
181 <a href=
"#" id=
"defaultTheme" onclick=
"return setActiveStyleSheet(this, 'win2k-1');">win2k-
1</a>
183 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'win2k-2');">win2k-
2</a>
185 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'win2k-cold-1');">win2k-cold-
1</a>
187 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'win2k-cold-2');">win2k-cold-
2</a>
189 <a href=
"#" onclick=
"return setActiveStyleSheet(this, 'system');">system
</a>
190 <script type=
"text/javascript">
191 setActiveStyleSheet(document.getElementById(
"defaultTheme"),
"win2k-1");
194 <a href=
"release-notes.html">Release notes
</a>.
196 Set it up in minutes:
197 <a href=
"simple-1.html">popup calendar
</a>,
198 <a href=
"simple-2.html">flat calendar
</a>.
201 <a href=
"doc/html/reference.html">HTML
</a>,
202 <a href=
"doc/reference.pdf">PDF
</a>.
204 <b style=
"color: red">Donate! Keep me on it! Details on
<a href=
"http://dynarch.com/mishoo/calendar.epl">the Calendar website
</a>.
</b>
207 <div style=
"padding-left:20px; font-size: 90%; font-style: italic;">
211 <table style=
"width: 100%">
213 <td style=
"background: #ffa; padding: 5px; border: 1px solid #995;">
216 <div style=
"background: #995; color: #ffa; font-weight: bold; padding: 2px;">
222 <b>Date #
1:
</b> <input type=
"text" name=
"date1" id=
"sel1" size=
"30"
223 ><input type=
"reset" value=
" ... "
224 onclick=
"return showCalendar('sel1', '%Y-%m-%d [%W] %H:%M', '24', true);"> %Y-%m-%d [%W] %H:%M -- single
227 <b>Date #
2:
</b> <input type=
"text" name=
"date2" id=
"sel2" size=
"30"
228 ><input type=
"reset" value=
" ... "
229 onclick=
"return showCalendar('sel2', '%a, %b %e, %Y [%I:%M %p]', '12');"> %a, %b %e, %Y [%I:%M %p]
234 if you remove this comment and leave the following HTML code
235 you will see a horrible effect, in all supported browsers (IE and Mozilla).
237 <SELECT multiple
size=
"4" name=
"component-select">
238 <OPTION selected
value=
"Component_1_a">Component_1
</OPTION>
239 <OPTION selected
value=
"Component_1_b">Component_2
</OPTION>
240 <OPTION>Component_3
</OPTION>
241 <OPTION>Component_4
</OPTION>
242 <OPTION>Component_5
</OPTION>
243 <OPTION>Component_6
</OPTION>
244 <OPTION>Component_7
</OPTION>
246 this select should hide when the calendar is above it.
249 <b>Date #
3:
</b> <input type=
"text" name=
"date3" id=
"sel3" size=
"30"
250 ><input type=
"reset" value=
" ... "
251 onclick=
"return showCalendar('sel3', '%d/%m/%Y');"> %d/%m/%Y
255 <b>Date #
4:
</b> <input type=
"text" name=
"date4" id=
"sel4" size=
"30"
256 ><input type=
"reset" value=
" ... "
257 onclick=
"return showCalendar('sel4', '%A, %B %e, %Y');"> %A, %B %e, %Y --
262 <p>This is release
<b>0.9.6</b>. Works on MSIE/Win
5.0 or better (really),
263 Opera
7, Mozilla, Netscape
6.x,
7.0 and all other Gecko-s, Konqueror and
266 <p class=
"help">You can click on
"Mo"/
"Su" (first day name displayed) to
267 change the first day of week (Sunday/Monday) (since
0.8 this is also mapped
268 on the
"-" button in the top-left corner). Use the navigation buttons
269 (
"<<",
"<",
"Today",
">",
">>") to move to the prev/next
270 year/month. Keep the mouse button pressed for a short time over one of
271 these buttons to get a menu for faster selection. You can drag the
"status
272 bar" (that's where the tooltips appear) or title bar (that's where the
273 currently selected month/year shows up) to move the whole calendar.
</p>
275 <h4>Keyboard navigation
</h4>
277 <p>Starting with version
0.9.2, you can also use the keyboard to select
278 dates (only for popup calendars; does
<em>not
</em> work with Opera
279 7 or Konqueror/Safari). The following keys are available:
</p>
283 <li><span class=
"key">←</span> ,
<span class=
"key">→</span> ,
284 <span class=
"key">↑</span> ,
<span class=
"key">↓</span> -- select date
</li>
285 <li><span class=
"key">CTRL
</span> +
<span class=
"key">←</span> ,
286 <span class=
"key">→</span> -- select month
</li>
287 <li><span class=
"key">CTRL
</span> +
<span class=
"key">↑</span> ,
288 <span class=
"key">↓</span> -- select year
</li>
289 <li><span class=
"key">SPACE
</span> -- go to
<em>today
</em> date
</li>
290 <li><span class=
"key">ENTER
</span> -- accept the currently selected date
</li>
291 <li><span class=
"key">ESC
</span> -- cancel selection
</li>
297 <td style=
"padding: 5px; margin: 5px; border: 1px solid #984; background: #ed9; width: 15em;">
299 <div style=
"background: #984; color: #fea; font-weight: bold; padding: 2px; text-align: center">
303 <p style=
"width: 12em"><small>A non-popup version will appear below as soon
304 as the page is loaded. Note that it doesn't show the week number.
</small></p>
306 <!-- the calendar will be inserted here -->
307 <div id=
"display" style=
"float: right; clear: both;"></div>
308 <div id=
"preview" style=
"font-size: 80%; text-align: center; padding: 2px"></div>
310 <p style=
"width: 12em"><small>
311 The example above uses the
<code>setDisabledHandler()
</code> member function
312 to setup a handler that would only enable days withing a range of
10 days,
313 forward or backward, from the current date.
324 © <a href=
"http://dynarch.com">dynarch.com
</a> 2002-
2003 <br />
325 Author:
<a href=
"http://dynarch.com/mishoo/">Mihai
326 Bazon
</a><br /> Distributed under the
<a
327 href=
"http://www.gnu.org/licenses/lgpl.html">GNU LGPL
</a>.
</address>
329 <p style=
"font-size: smaller">If you use this script on a public page it
330 would be nice if you would
<a href=
"mailto:mishoo@infoiasi.ro">let me