1 <html style="background-color: buttonface; color: buttontext;">
4 <meta http-equiv="content-type" content="text/xml; charset=utf-8" />
6 <title>Simple calendar setup [flat calendar]</title>
8 <!-- calendar stylesheet -->
9 <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
11 <!-- main calendar program -->
12 <script type="text/javascript" src="calendar.js"></script>
14 <!-- language for the calendar -->
15 <script type="text/javascript" src="lang/calendar-en.js"></script>
17 <!-- the following script defines the Calendar.setup helper function, which makes
18 adding a calendar a matter of 1 or 2 lines of code. -->
19 <script type="text/javascript" src="calendar-setup.js"></script>
25 <h2>DHTML Calendar — for the impatient</h2>
29 This page demonstrates how to setup a flat calendar. Examples of
30 <em>popup</em> calendars are available in <a
31 href="simple-1.html">another page</a>.
34 The code in this page uses a helper function defined in
35 "calendar-setup.js". With it you can setup the calendar in
36 minutes. If you're not <em>that</em> impatient, ;-) <a
37 href="doc/html/reference.html">complete documenation</a> is
46 <div style="float: right; margin-left: 1em; margin-bottom: 1em;"
47 id="calendar-container"></div>
49 <script type="text/javascript">
50 function dateChanged(calendar) {
51 // Beware that this function is called even if the end-user only
52 // changed the month/year. In order to determine if a date was
53 // clicked you can use the dateClicked property of the calendar:
54 if (calendar.dateClicked) {
55 // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
56 var y = calendar.date.getFullYear();
57 var m = calendar.date.getMonth(); // integer, 0..11
58 var d = calendar.date.getDate(); // integer, 1..31
60 window.location = "/" + y + "/" + m + "/" + d + "/index.php";
66 flat : "calendar-container", // ID of the parent element
67 flatCallback : dateChanged // our callback function
72 <p>The positioning of the DIV that contains the calendar is entirely your
73 job. For instance, the "calendar-container" DIV from this page has the
74 following style: "float: right; margin-left: 1em; margin-bottom: 1em".</p>
76 <p>Following there is the code that has been used to create this calendar.
77 You can find the full description of the <tt>Calendar.setup()</tt> function
78 in the <a href="doc/html/reference.html">calendar documenation</a>.</p>
81 ><div style="float: right; margin-left: 1em; margin-bottom: 1em;"
82 id="calendar-container"></div>
84 <script type="text/javascript">
85 function dateChanged(calendar) {
86 // Beware that this function is called even if the end-user only
87 // changed the month/year. In order to determine if a date was
88 // clicked you can use the dateClicked property of the calendar:
89 if (calendar.dateClicked) {
90 // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
91 var y = calendar.date.getFullYear();
92 var m = calendar.date.getMonth(); // integer, 0..11
93 var d = calendar.date.getDate(); // integer, 1..31
95 window.location = "/" + y + "/" + m + "/" + d + "/index.php";
101 flat : "calendar-container", // ID of the parent element
102 flatCallback : dateChanged // our callback function
105 </script></pre>