/////////////////////////////////////////////////////////////////////////////////////////// // // Program : diary.js // Purpose : To provide an events diary where only today and future events are displayed to // reduce the update time required. Translates dates into standard format // e.g. Friday 15 February 2002. // Author : Greg Griffiths (greg.griffiths@greggriffiths.org) // Version : 1.0 // Release Date : 15 February 2002 // URL : http://www.greggriffiths.org/webdev/clientside/javascript/eventsdiary/ // // © Copyright : Greg Griffiths (2002) // // This Javascript script is for freeware use, however, the owner would appreciate a mention on the // users site including a link back to his site as well as being told where his code is being used. // /////////////////////////////////////////////////////////////////////////////////////////// // Object constructor function eventInfo(day, month, year, time, event) { this.day = day; this.month = month; this.year = year; this.time = time; this.event = event; } // this function builds the table component of the page function display_diary() { var eventDiary = new Array(); var today = new Date(); var aday; var amonth; var ayear; var printit; var bgcol; // set other local variables aday = today.getDate(); amonth = today.getMonth() + 1; ayear = today.getFullYear(); bgcol="#CCCCCC"; // this is the diary, one row per event, remember that the first row must be eventDiary[0] eventDiary[0] = new eventInfo("17","02","2002","10:30","Rev John Perkins (Holy Communion)"); eventDiary[1] = new eventInfo("17","02","2002","6:30","Mr Tom Parkinson"); eventDiary[2] = new eventInfo("24","02","2002","10:30","Mrs Ann Parkinson"); eventDiary[3] = new eventInfo("24","02","2002","6:30","Mr J Scott"); eventDiary[4] = new eventInfo("03","03","2002","10:30","Mr J Whitehead"); eventDiary[5] = new eventInfo("03","03","2002","2:30","Circuit Service at Kniveton Rev Trevor Staniforth"); eventDiary[6] = new eventInfo("10","03","2002","10:30","Miss Diana Whitmill"); eventDiary[7] = new eventInfo("10","03","2002","6:30","Sister Merle Wilde"); eventDiary[8] = new eventInfo("17","03","2002","10:30","Rev Trevor Staniforth"); eventDiary[9] = new eventInfo("17","03","2002","6:30","Mrs S Massey"); eventDiary[10] = new eventInfo("24","03","2002","10:30","Mr John Turner"); eventDiary[11] = new eventInfo("24","03","2002","6:30","Rev K Cupit"); eventDiary[12] = new eventInfo("29","03","2002","11.00","Mr Tim Dutton"); eventDiary[13] = new eventInfo("29","03","2002","12:30","ACT Walk of Witness, Victoria Square"); eventDiary[14] = new eventInfo("30","03","2002"," ","Milldale Walk"); eventDiary[15] = new eventInfo("30","07","2002","2:30","Service at Milldale - Rev Trevor Staniforth"); eventDiary[16] = new eventInfo("31","08","2002","8.00","Rev John Perkins"); eventDiary[17] = new eventInfo("31","09","2002","10:30","Rev Wesley Blakey"); eventDiary[18] = new eventInfo("31","10","2002","6:30","Mr John Turner"); // set a local variable equal to the length of the array var maxEntries=eventDiary.length; // print out the header document.write("
| Date | Time | Event |
| " + whichDayName + " " + eventDiary[i].day + " " + whichMonthName + " " + eventDiary[i].year + " | " + eventDiary[i].time + " | " + eventDiary[i].event + " |