Inculcating a Sense of Destiny, Dignity, Morality and Power
Free Website Application

Application closes on the 30th Nov. 2009

2ND Phase Opens Jan. 23RD 2010

RoutePay Register

Instantly Send and Receive Money Worldwide

Join Netprofits Network

Home
Get a Free Website
Free Game Room
Bible Search
RTI Calendar
Answers/ Articles
Accounting Software
NGOs/NPOs Facts
Sponsors

How to include additional info in day cells

The idea is simple:

  1. Define a callback that takes two parameters like this:

    function getDateText(date, d)

    This function will receive the date object as the first parameter and the current date number (1..31) as the second (you can get it as well by calling date.getDate() but since it's very probably useful I thought I'd pass it too so that we can avoid a function call).

    This function must return the text to be inserted in the cell of the passed date. That is, one should at least "return d;".

  2. Pass the above function as the "dateText" parameter to Calendar.setup.

The function could simply look like:

  function getDateText(date, d) {
    if (d == 12) {
      return "12th";
    } else if (d == 13) {
      return "bad luck";
    } /* ... etc ... */
  }

but it's easy to imagine that this approach sucks. For a better way, see the source of this page and note the usage of an externally defined "dateText" object which maps "date" to "date info", also taking into account the year and month. This object can be easily generated from a database, and the getDateText function becomes extremely simple (and static).

Cheers!


mishoo
Last modified: Sat Mar 5 17:18:06 EET 2005

 

 

 
 

Download Budget Calendar from www.Soft-Go.Com

 

LRWestern Union

Send mail to webmaster@scnnigeria.net with questions or comments about this web site.
Copyright © 2009 Relationship TRENDS International Inc.
Last Edited: Wednesday, 23. May 2012 15:44:47 -0400