Calendar Example 1
Home ] Up ] [ Calendar Example 1 ] Calendar Example 2 ] Calendar Example 3 ]

How the Calendar Works ] Calendar Examples ] Calendar Files ]

This page illustrates the simplest use of the JavaScript Event Calendar.

 

It consists of only two small pieces of JavaScript code:

The first required JavaScript statement can go anywhere in the HTML page, as long as it is before the place where you want the calendar to appear.

<script src="calendar.js"></script>

This statement instructs the client browser to download the CALENDAR.JS file.   That file contains all of the "code" for the JavaScript Event Calendar.

Then place the second piece of JavaScript at the exact spot in the page where you want the calendar to show.

<script language="JavaScript">
<!--
Calendar( );
// -->
</script>

The first line indicates the beginning of an in-line JavaScript program. The second line is a tricky way to make sure that older versions of browsers (that don't understand JavaScript) don't "blow up"; they'll simply ignore the rest of the script.  The third line is the important one: it displays the calendar.   The fourth line is another trick for "Java-impaired" browsers, and the fifth line ends the script program.

By calling the Calendar( ) function without first defining any events, and without overriding any of the default configuration settings, you get a calendar with the following characteristics:

  • it runs from January through December of the current year;
  • its regularly highlighted "special day" is Sunday;
  • it highlights the special day in red and the current day (today) in green;
  • the calendar background is light yellow;
  • there are no events on any of the days!

Before attempting to implement the JavaScript Event Calendar on your own web page, it would be a good idea to study ALL of the examples.

Next ]