473,850 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disply weekly,daily calendar using javascript

118 New Member
hi,

i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i have to made in my code

Expand|Select|Wrap|Line Numbers
  1.  
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <title>sayhi</title>
  7. <link href="stylesheet.css" rel="stylesheet" type="text/css" />
  8.  
  9.  
  10. <script language="JavaScript" type="text/javascript" src="events.js"></script>
  11.  
  12. <script type="text/JavaScript" language="JavaScript">
  13.  
  14.  
  15. var thisDate = 1;                            // Tracks current date being written in calendar
  16. var wordMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  17. var today = new Date();                            // Date object to store the current date
  18. var todaysDay = today.getDay() + 1;                    // Stores the current day number 1-7
  19. var todaysDate = today.getDate();                    // Stores the current numeric date within the month
  20. var todaysMonth = today.getUTCMonth() + 1;                // Stores the current month 1-12
  21. var todaysYear = today.getFullYear();                    // Stores the current year
  22. var monthNum = todaysMonth;                        // Tracks the current month being displayed
  23. var yearNum = todaysYear;                        // Tracks the current year being displayed
  24. var firstDate = new Date(String(monthNum)+"/1/"+String(yearNum));    // Object Storing the first day of the current month
  25. var firstDay = firstDate.getUTCDay();                    // Tracks the day number 1-7 of the first day of the current month
  26. var lastDate = new Date(String(monthNum+1)+"/0/"+String(yearNum));    // Tracks the last date of the current month
  27. var numbDays = 0;
  28. var calendarString = "";
  29. var eastermonth = 0;
  30. var easterday = 0;
  31. var date =0;
  32. var event8="";
  33. var events1="hello";
  34.  
  35. events = new Array(
  36. ["Y",    "11",    "8",    "2008",    "1:00 AM",    "12:59 PM",    "beautiful day",    "aweewwewweeweweww"],
  37.     ["Y",    "11",    "22",    "2008",    "1:00 AM",    "12:59 PM",    "beautiful days",    "wewewewewewqwewwew"],
  38.     ["Y",    "11",    "8",    "2008",    "1:00 AM",    "12:59 PM",    "rrrrrrr",    "rrrrrrr"],
  39.     ["Y",    "11",    "22",    "2006",    "1:00 AM",    "12:59 PM",    "wwwwww",    "wwwwww"],
  40.     ["Y",    "11",    "8",    "2006",    "1:00 AM",    "12:59 PM",    "avvvvvvvvv",    "avvvvvvvvv"],
  41.     ["Y",    "11",    "22",    "2005",    "1:00 AM",    "12:59 PM",    "ssssssssss",    "ssssssssss"],
  42.     ["Y",    "11",    "8",    "2005",    "1:00 AM",    "12:59 PM",    "zzzzzzzzz",    "zzzzzzzzz"],
  43.     ["Y",    "11",    "22",    "2009",    "1:00 AM",    "12:59 PM",    "ddddddd",    "ddddddd"],
  44.     ["Y",    "11",    "8",    "2009",    "1:00 AM",    "12:59 PM",    "hhhhhhhh",    "hhhhhhhh"],
  45.     ["Y",    "11",    "22",    "2010",    "1:00 AM",    "12:59 PM",    "vvvvvvv",    "vvvvvvv"],
  46.     ["Y",    "11",    "8",    "2010",    "1:00 AM",    "12:59 PM",    "bbbbbbbb",    "bbbbbbbb"],
  47.     ["Y",    "10",    "1",    "2011",    "1:00 AM",    "12:59 PM",    "kkkkkkk",    "kkkkkkk"],
  48.     ["Y",    "10",    "2",    "2011",    "1:00 AM",    "12:59 PM",    "xxxxxxxxxx",    "xxxxxxxxxx"],
  49.     ["Y",    "9",    "9",    "2007",    "1:00 AM",    "12:59 PM",    "vvvvvvvvvv",    "vvvvvvvvvv"],
  50.     ["Y",    "9",    "8",    "2007",    "1:00 AM",    "12:59 PM",    "ccccccccccc",    "ccccccccccc"],
  51.     ["Y",    "11",    "2",    "2006",    "1:00 AM",    "12:59 PM",    "wbbbbbbbbbb",    "wbbbbbbbbbb"],
  52.     ["Y",    "11",    "3",    "2006",    "1:00 AM",    "12:59 PM",    "nnnnnnnnnnnnnn",    "nnnnnnnnnnnnnn"],
  53.     ["Y",    "11",    "22",    "2005",    "1:00 AM",    "12:59 PM",    "jjjjjjjjjj",    "jjjjjjjjjj"],
  54.     ["Y",    "11",    "8",    "2005",    "1:00 AM",    "12:59 PM",    "oooooo",    "oooooo"],
  55.     ["Y",    "11",    "22",    "2004",    "1:00 AM",    "12:59 PM",    "hhhhh",    "hhhhh"],
  56.     ["Y",    "11",    "8",    "2004",    "1:00 AM",    "12:59 PM",    "vbvbvn",    "vbvbvn"],
  57.     ["Y",    "10",    "22",    "2008",    "1:00 AM",    "12:59 PM",    "uuuuuu",    "uuuuuu"],
  58.     ["Y",    "10",    "8",    "2008",    "1:00 AM",    "12:59 PM",    "llkuiiu",    "llkuiiu"],
  59.     ["Y",    "12",    "22",    "2008",    "1:00 AM",    "12:59 PM",    "ghjhj",    "ghjhj"],
  60.     ["Y",    "12",    "8",    "2008",    "1:00 AM",    "12:59 PM",    "awee",    "awee"],
  61.     ["Y",    "11",    "23",    "2008",    "1:00 AM",    "12:59 PM",    "ewewqwewwew",    "ewewqwewwew"],
  62.     ["Y",    "1",    "1",    "2006",    "1:00 AM",    "12:00 PM",    "New Year's Day",    "New Year's Day will be ushered in with great joy and celebration. Come as you are."],
  63.     ["F",    "1",    "3",    "2",    "1:00 AM",    "12:59 PM",    "Martin Luther King Day",    "Honors civil rights leader Rev Martin Luther King."],
  64.     ["Y",    "2",    "2",    "2008",    "1:00 AM",    "12:59 PM",    "Groundhog Day",    "If Philadelphia's groundhog 'Punxsutawney Phil' sees his shadow, there will be six more weeks of winter weather. If he does not see his shadow, there will be an early spring."],
  65.     ["Y",    "2",    "14",    "2005",    "1:00 AM",    "12:59 PM",    "Valentine's Day",    "Traditional celebration of love and romance, including the exchange of cards, candy, flowers, and other gifts."],
  66.     ["F",    "2",    "3",    "2",    "1:00 AM",    "12:59 PM",    "President's Day",    "Honors the birthdays of George Washington, Abraham Lincoln and other past American Presidents."],
  67.     ["F",    "3",    "0",    "0",    "1:00 AM",    "12:59 PM",    "Easter",    "Traditional celebration of the resurrection of Jesus Christ."],
  68.     ["Y",    "3",    "17",    "2005",    "1:00 AM",    "12:59 PM",    "St. Patrick's Day",    "A celebration of Irish heritage and culture, based on the Catholic feast of St. Patrick. Primary activity is simply the wearing of green clothing ('wearing of the green')."],
  69.     ["Y",    "3",    "22",    "2005",    "1:00 AM",    "12:59 PM",    "World Water Day",    "A day to promote appreciation of the world's most valuable commodity - water."],
  70.     ["Y",    "4",    "1",    "2005",    "1:00 AM",    "12:59 PM",    "April Fool's Day",    "A day to play tricks on or 'fool' family, friends, and coworkers, if so inclined. As Ecclesiastes says: 'There is a time for everything'; in this case, a time to be silly."],
  71.     ["F",    "5",    "2",    "1",    "1:00 AM",    "12:59 PM",    "Mother's Day",    "Honors mothers and motherhood (made a Federal Holiday by Presidential order)."],
  72.     ["F",    "5",    "3",    "7",    "1:00 AM",    "12:59 PM",    "Armed Forces Day",    "Celebrates the United States Army, Navy, Air Force and Marine Corps; formerly - each used to have separate days."],
  73.     ["F",    "5",    "4",    "2",    "1:00 AM",    "12:59 PM",    "Memorial Day",    "Honors the nation's war dead, and those we love who have passed away. Traditionally a time to decorate graves and remember those who have gone before us. Also marks traditional beginning of summer."],
  74.     ["Y",    "6",    "14",    "2005",    "1:00 AM",    "12:59 PM",    "Flag Day",    "Honors the American flag, encourages patriotism. Citizens are urged to fly the flag and study its traditions."],
  75.     ["F",    "6",    "3",    "1",    "1:00 AM",    "12:59 PM",    "Father's Day",    "Honors all Fathers and fatherhood."],
  76.     ["Y",    "7",    "4",    "2005",    "1:00 AM",    "12:59 PM",    "Independence Day",    "Celebrates our Declaration of Independence from England in 1776, usually called the Fourth of July."],
  77.     ["F",    "9",    "1",    "2",    "1:00 AM",    "12:59 PM",    "Labor Day",    "Celebrates the achievements of workers, giving them a day of rest - marks traditional end of summer."],
  78.     ["F",    "10",    "2",    "2",    "1:00 AM",    "12:59 PM",    "Columbus' Day",    "Honors the traditional discovery of the Americas by Christopher Columbus."],
  79.     ["Y",    "10",    "31",    "2005",    "1:00 AM",    "12:59 PM",    "Halloween",    "Celebrates All Hallow's Eve, decorations include jack o'lanterns, costume wearing parties, and candy - considered a pagan holiday by many Christians."],
  80.     ["Y",    "11",    "11",    "2005",    "1:00 AM",    "12:59 PM",    "Veteran's Day",    "Honors all veterans of the United States armed forces. A traditional observation is a moment of silence at 11 AM remembering those who fought for peace."],
  81.     ["F",    "11",    "4",    "5",    "1:00 AM",    "12:59 PM",    "Thanksgiving",    "A day to give thanks for your many blessings - traditionally for the Autumn harvest, and it marks the beginning of the 'holiday season'."],
  82.     ["Y",    "12",    "25",    "2009",    "1:00 AM",    "12:59 PM",    "Christmas",    "Celebration of the traditional day of Jesus' birth - God was made flesh and dwelt among us."]
  83.  
  84.  
  85. // Please omit the final comma after the ] from the last line above unless you are going to add another event at this time.
  86. );
  87.  
  88. function events1(event8)
  89. {
  90.  
  91. return event8;
  92. }
  93.  
  94. function prod(date1,date2)
  95. {
  96. x=date1;
  97. this.date2=date2;
  98. this.date1=date1;
  99.  
  100. return x;
  101. }
  102. var events2=prod("hi","11");
  103. var house1=new prod("hello","11");
  104.  
  105. document.write(daycounter);
  106.  
  107.  
  108. function changedate(buttonpressed) {
  109.     if (buttonpressed == "prevyr") yearNum--;
  110.     else if (buttonpressed == "nextyr") yearNum++;
  111.     else if (buttonpressed == "prevmo") monthNum--;
  112.     else if (buttonpressed == "nextmo") monthNum++;
  113.     else if (buttonpressed == "nextmo1") {
  114.     monthNum=document.getElementById("select3");
  115.  
  116.     }
  117.     else  if (buttonpressed == "return") { 
  118.         monthNum = todaysMonth;
  119.         yearNum = todaysYear;
  120.     }
  121.  
  122.     if (monthNum == 0) {
  123.         monthNum = 12;
  124.         yearNum--;
  125.     }
  126.     else if (monthNum == 13) {
  127.         monthNum = 1;
  128.         yearNum++
  129.     }
  130.  
  131.     lastDate = new Date(String(monthNum+1)+"/0/"+String(yearNum));
  132.     numbDays = lastDate.getDate();
  133.     firstDate = new Date(String(monthNum)+"/1/"+String(yearNum));
  134.     firstDay = firstDate.getDay() + 1;
  135.     createCalendar();
  136.     return;
  137. }
  138.  
  139.  
  140.  
  141. function easter(year) {
  142. // feed in the year it returns the month and day of Easter using two GLOBAL variables: eastermonth and easterday
  143. var a = year % 19;
  144. var b = Math.floor(year/100);
  145. var c = year % 100;
  146. var d = Math.floor(b/4);
  147. var e = b % 4;
  148. var f = Math.floor((b+8) / 25);
  149. var g = Math.floor((b-f+1) / 3);
  150. var h = (19*a + b - d - g + 15) % 30;
  151. var i = Math.floor(c/4);
  152. var j = c % 4;
  153. var k = (32 + 2*e + 2*i - h - j) % 7;
  154. var m = Math.floor((a + 11*h + 22*k) / 451);
  155. var month = Math.floor((h + k - 7*m + 114) / 31);
  156. var day = ((h + k - 7*m +114) % 31) + 1;
  157. eastermonth = month;
  158. easterday = day;
  159. }
  160.  
  161.  
  162. function createCalendar() {
  163.     calendarString = '';
  164.     var daycounter = 0;
  165.         calendarString +='<tr>';
  166.         calendarString +='<td class=\"tdpad\" colspan=\"2\">';
  167.         calendarString +='<table width=\"741\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">';
  168.         calendarString +='<tr>';
  169.         calendarString +='<td height=\"20\" colspan=\"4\" valign=\"top\"><a class=\"breadlink\" href=\"#\">Home</a> -  Calender of Events</td>';
  170.         calendarString +='</tr>';
  171.         calendarString +='<tr>';
  172.         calendarString +='<td width=\"21%\" height=\"30\"><font class=\"calender\">'+ wordMonth[monthNum-1]+ yearNum+'</font></td>';
  173.         calendarString +='<td colspan=\"3\" align=\"right\">';
  174.         calendarString +='<input class=\"btn2\" type=\"submit\" name=\"Submit\" value=\"Import Events\" />';
  175.         calendarString +='<input class=\"btn2\" type=\"submit\" name=\"Submit2\" value=\"Open Window\" />';
  176.         calendarString +='</td>';
  177.         calendarString +='</tr>';
  178.         calendarString +='<tr>';
  179.         calendarString +='<td height=\"30\"><a href=\"#\" class=\"etext\">Month</a> - <a href=\"#\" class=\"etext\">Week</a> - <a href=\"#\" class=\"etext\">Day</a></td>';
  180.         calendarString +='<td width=\"47%\" align=\"center\">';
  181.         calendarString +='<a class=\"etext\" href=\"#\" onClick=\"changedate(\'prevmo\')\">&lt;&lt;&lt; Previous</a>';
  182.         calendarString +='<select name=\"select3\" id=\"select3\" onChange=\"changedate(\'nextmo1\')\">';
  183.                   calendarString +='<option value='+ wordMonth[monthNum-1]+'>'+ wordMonth[monthNum-1]+'</option>';
  184.                   calendarString +='<option value='+ wordMonth[monthNum-2]+'>'+ wordMonth[monthNum-2]+'</option>';
  185.                   calendarString +='<option value='+ wordMonth[monthNum-3]+'>'+ wordMonth[monthNum-3]+'</option>';
  186.                   calendarString +='<option value='+ wordMonth[monthNum-4]+'>'+ wordMonth[monthNum-4]+'</option>';
  187.                   calendarString +='<option name='+ wordMonth[monthNum-5]+'>'+ wordMonth[monthNum-5]+'</option>';
  188.                   calendarString +='<option name='+ wordMonth[monthNum-6]+'>'+ wordMonth[monthNum-6]+'</option>';
  189.                   calendarString +='<option name='+ wordMonth[monthNum-7]+'>'+ wordMonth[monthNum-7]+'</option>';
  190.                   calendarString +='<option name='+ wordMonth[monthNum-8]+'>'+ wordMonth[monthNum-8]+'</option>';
  191.                   calendarString +='<option name='+ wordMonth[monthNum-9]+'>'+ wordMonth[monthNum-9]+'</option>';
  192.                   calendarString +='<option name='+ wordMonth[monthNum-10]+'>'+ wordMonth[monthNum-10]+'</option>';
  193.                   calendarString +='<option name='+ wordMonth[monthNum-11]+'>'+ wordMonth[monthNum-11]+'</option>';
  194.                   calendarString +='<option name='+ wordMonth[monthNum]+'>'+ wordMonth[monthNum]+'</option>';
  195.                 calendarString +='</select>';
  196.                 calendarString +='<select name=\"select4\">';
  197.                  calendarString +='<option>'+ yearNum+'</option>';
  198.                 calendarString +='</select>';
  199.         calendarString +='<a class=\"etext\" href=\"#\" onClick=\"changedate(\'nextyr\')\">Next  &gt;&gt;&gt;</a>';
  200.         calendarString +='</td>';
  201.         calendarString +='<td width=\"27%\">';
  202.             calendarString +='<a href=\"#\" class=\"etext\">Login</a> - <a href=\"#\" class=\"etext\">Search</a>';
  203.             calendarString +='<select name=\"select\">';
  204.             calendarString +='<option>Hi-Radar Events</option>';
  205.             calendarString +='</select>';
  206.             calendarString +='</td>';
  207.             calendarString +='<td>';
  208.             calendarString +='<input name=\"image\" type=\"image\" value=\"Submit\" src=\"http://bytes.com/images/search.gif\" />';
  209.             calendarString +='</td>';
  210.         calendarString +='</tr>';
  211.  
  212.         calendarString +='</table>';
  213.         calendarString +='</td>';
  214.          calendarString += '</tr>';
  215.      calendarString += '<tr>';
  216.         calendarString += '<td style=\"padding-right:12px;\" height=\"26\" align=\"right\" ><a class=\"elink\" href=\"#\">View Open-Win</a> - <a class=\"elink\" href=\"#\">Manage Open-Win</a> - <a class=\"elink\" href=\"#\">Browse Open-Win</a> - <a class=\"elink\" href=\"#\">View My Bookmark</a></td>';
  217.             calendarString +='</tr>';
  218.  
  219.  
  220.     calendarString += '<table width="741" height="630" border="0" cellpadding="0" cellspacing="1">';
  221.  
  222.     calendarString += '<tr>';
  223.  
  224.     calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Sunday</td>';
  225. calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Monday</td>';
  226. calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Tuesday</td>';
  227. calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Wednesday</td>';
  228. calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Thursday</td>';
  229. calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Friday</td>';
  230. calendarString += '<td width=\"106\" height=\"26\" align=\"center\" bgcolor=\"#4F7637\" class=\"font\">Saturday</td>';
  231. calendarString += '</tr>';
  232.  
  233.     thisDate == 1;
  234.  
  235.     for (var i = 1; i <= 6; i++) {
  236.         calendarString += '<tr>';
  237.         for (var x = 1; x <= 7; x++) {
  238.             daycounter = (thisDate - firstDay)+1;
  239.             thisDate++;
  240.             if ((daycounter > numbDays) || (daycounter < 1)) {
  241.                 calendarString += '<td align=\"center\" bgcolor=\"#F2F8ED\"  width=\"106\">&nbsp;<\/td>';
  242.             } else {
  243.                 if (checkevents(daycounter,monthNum,yearNum,i,x) || ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum))){
  244.                     if ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum)) {
  245.                         calendarString += '<td align=\"center\" bgcolor=\"#F2F8ED\"  width=\"106\">&nbsp</td>';
  246.                     }
  247.                      else{
  248.                          var showevent=showevents(daycounter,monthNum,yearNum,"i","x");
  249.                          calendarString += '<td align=\"center\" bgcolor=\"#F2F8ED\"  width=\"106\">'+ showevent +  daycounter + '<\/td>';    
  250.                      var showevent=showevents(daycounter,monthNum,yearNum,"i","x");
  251.                      }
  252.                 } else {
  253.                     calendarString += '<td align=\"center\" bgcolor=\"#F2F8ED\"  width=\"106\">' + daycounter + '<\/td>';
  254.                 }
  255.             }
  256.         }
  257.         calendarString += '<\/tr>';
  258.     }
  259.  
  260.     '<\/table>';
  261.  
  262.     var object=document.getElementById('calendar');
  263.     object.innerHTML= calendarString;
  264.     thisDate = 1;
  265. }
  266.  
  267.  
  268. function checkevents(day,month,year,week,dayofweek) {
  269. var numevents = 0;
  270. var floater = 0;
  271. for (var i = 0; i < events.length; i++) {
  272.  
  273.         if (events[0][0] == "W") {
  274.             if ((events[0][2] == dayofweek)) numevents++;
  275.         }
  276.         else if (events[0][0] == "Y") {
  277.             if ((events[0][2] == day) && (events[0][1] == month) && (events[0][3] == year) ) numevents++;
  278.         }
  279.         else if (events[0][0] == "F") {
  280.             if ((events[0][1] == 3) && (events[0][2] == 0) && (events[0][3] == 0) ) {
  281.                 easter(year);
  282.                 if (easterday == day && eastermonth == month) numevents++;
  283.             } else {
  284.                 floater = floatingholiday(year,events[i][1],events[i][2],events[i][3]);
  285.                 if ((month == 5) && (events[i][1] == 5) && (events[i][2] == 4) && (events[i][3] == 2)) {
  286.                     if ((floater + 7 <= 31) && (day == floater + 7)) {
  287.                         numevents++;
  288.                     } else if ((floater + 7 > 31) && (day == floater)) numevents++;
  289.                 } else if ((events[0][1] == month) && (floater == day)) numevents++;
  290.             }
  291.         }
  292.         else if ((events[0][2] == day) && (events[0][1] == month) && (events[0][3] == year)) {
  293.             numevents++;
  294.  
  295.         }
  296.     }
  297.  
  298.     if (numevents == 0) {
  299.         return false;
  300.     } else {
  301.         return true;
  302. }    
  303.  
  304. }
  305.  
  306.     function showevents(day,month,year,week,dayofweek) {
  307. var theevent = "";
  308. var floater = 0;
  309. var eventhan="ww";
  310.     for (var i = 0; i < events.length; i++) {
  311.     if (events[i][0] != "") {
  312.         // First we'll process recurring events (if any):
  313.             if (events[i][0] == "Y") {
  314.             if ((events[i][2]==day) && (events[i][1] == month) && (events[i][3] == year) ) {
  315.  
  316.                 theevent += events[i][6] + '\n';
  317.                 theevent += '\n -------------- \n\n';
  318.  
  319.                 return theevent;
  320.                 }
  321.                 }
  322.                 }
  323.     }
  324. }
  325.  
  326.  
  327. function floatingholiday(targetyr,targetmo,cardinaloccurrence,targetday) {
  328. // Floating holidays/events of the events.js file uses:
  329. //    the Month field for the Month (here it becomes the targetmo field)
  330. //    the Day field as the Cardinal Occurrence  (here it becomes the cardinaloccurrence field)
  331. //        1=1st, 2=2nd, 3=3rd, 4=4th, 5=5th, 6=6th occurrence of the day listed next
  332. //    the Year field as the Day of the week the event/holiday falls on  (here it becomes the targetday field)
  333. //        1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thurday, 6=Friday, 7=Saturday
  334. //    example: "F",    "1",    "3",    "2", = Floating holiday in January on the 3rd Monday of that month.
  335. //
  336. // In our code below:
  337. //     targetyr is the active year
  338. //     targetmo is the active month (1-12)
  339. //     cardinaloccurrence is the xth occurrence of the targetday (1-6)
  340. //     targetday is the day of the week the floating holiday is on
  341. //        0=Sun; 1=Mon; 2=Tue; 3=Wed; 4=Thu; 5=Fri; 6=Sat
  342. //        Note: subtract 1 from the targetday field if the info comes from the events.js file
  343. //
  344. // Note:
  345. //    If Memorial Day falls on the 22nd, 23rd, or 24th, then we add 7 to the dayofmonth to the result.
  346. //
  347. // Example: targetyr = 2052; targetmo = 5; cardinaloccurrence = 4; targetday = 1
  348. //    This is the same as saying our floating holiday in the year 2052, is during May, on the 4th Monday
  349. //
  350. var firstdate = new Date(String(targetmo)+"/1/"+String(targetyr));    // Object Storing the first day of the current month.
  351. var firstday = firstdate.getUTCDay();    // The first day (0-6) of the target month.
  352. var dayofmonth = 0;    // zero out our calendar day variable.
  353.  
  354.     targetday = targetday - 1;
  355.  
  356.     if (targetday >= firstday) {
  357.         cardinaloccurrence--;    // Subtract 1 from cardinal day.
  358.         dayofmonth = (cardinaloccurrence * 7) + ((targetday - firstday)+1);
  359.     } else {
  360.         dayofmonth = (cardinaloccurrence * 7) + ((targetday - firstday)+1);
  361.     }
  362. return dayofmonth;
  363. }
  364. </script>
  365.  
  366.  
  367. </head>
  368.  
  369. <body class="homebg" onload="changedate('return')">
  370. <%@ include file="includes/header.jsp" %>
  371. <table width="781" border="0" align="center" cellpadding="0" cellspacing="0">
  372.   <tr>
  373.     <td class="intab" align="left" valign="top"><table width="765" border="0" cellspacing="0" cellpadding="0">
  374.  
  375.  
  376.  
  377.       <tr>
  378.         <td class="tdpad2" align="left" valign="top">
  379.  
  380.  
  381.  
  382. <center>
  383. <table id="evtcal" border="0" cellpadding="0" cellspacing="0" width="584">
  384.     <tbody>
  385.         <tr>
  386.             <td style="padding: 3px;" align="center" bgcolor="#FFFFFF" valign="top" width="314">
  387.                 <div id="calendar"><!--  Dynamically Filled --></div>
  388.                 </td>
  389.             <td width="10">&nbsp;</td>
  390.  
  391.         </tr>
  392.     </tbody>
  393. </table>
  394. </center>
  395.  
  396.         </td>
  397.       </tr>
  398.     </table></td>
  399.   </tr>
  400. </table>
  401. <%@ include file="includes/footer.jsp" %>
  402. </body>
  403. </html>
  404.  
  405.  
i want the daily,weekly calendar .plz suggest how i made changes into that code.
Nov 25 '08 #1
1 3467
acoder
16,027 Recognized Expert Moderator MVP
From the createCalendar( ) function, I can see you're using a table. So modify/add to change the layout for a weekly/daily calendar. How do you want it triggered/to be displayed as a daily/weekly instead of monthly?
Nov 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1434
by: Irmen de Jong | last post by:
QOTW: "To make the instructions even friendlier it would also help if 'but Whatever You Do DON'T UNZIP THE FREAKIN' THING - This Means YOU John Latter!' were in large, bold, and underlined type. And preferably a different colour." -- John Latter, on Python's install instructions " What's more, these are three of Python's greatest *strengths*. We resist all attempts to change these, and we (at least I) avoid other languages because...
0
1313
by: Cameron Laird | last post by:
QOTW: praise than which there is no higher: "I like the Python Cookbook, edited by Alex Martelli and David Ascher. I keep that one in my bathroom." Terry Carroll "e needed something more complex and expensive because the response to any IT problem is to spend more money making things more complex." Robert X. Cringely on voting machines http://www.pbs.org/cringely/pulpit/pulpit20031204.html
18
3052
by: Cameron Laird | last post by:
QOTW: "... So I started profiling the code and the slowdown was actually taking place at places where I didn't expect it." -- Guyon Mor?e (and about twenty-three thousand others) " suggestion from the world of 'agile development': stop making so many decisions and start writing some actual code!" -- Peter Hansen Scott David Daniels and others illustrate that the most common answer for Python is, "It's (already) in there." In the...
0
1347
by: Magnus Lycka | last post by:
QOTW: "*what* the value is is defined by the operations that the object supports (via its type). *how* the value is represented inside the object is completely irrelevant; a Python implementation may use electric charges in small capacitors, piles of rocks, diapers,or an endless supply of small guys in odd costumes to encode the value inside an object. Changes to the value may be carried out by CPU instructions, caterpillars, toddlers...
0
1112
by: Peter Otten | last post by:
QOTW: "It seems if you lurk here long enough you eventually get all you questions answered without even asking!" - Ted Landis "We're going to learn from Python. JavaScript is pretty close to Python" - Brendan Eich Scott David Daniels shows how to find all occurrences of a string in another string without using regular expressions. http://groups.google.com/group/comp.lang.python/msg/f19cdf6de899c755
2
1319
by: Paul Boddie | last post by:
QOTW: "We of all people should understand Worse Is Better. And I forgot to mention a little flash in the pan called Python, for which Tkinter (2+2 left as an exercise) is the GUI of choice." - Ken Tilton (on comp.lang.lisp, perhaps stretching the meaning of "of choice" somewhat) http://groups.google.com/group/comp.lang.lisp/msg/4d4945fb2706fc24 "It isn't that mobile platforms speak a different language to the web: they're perfectly...
1
3737
by: Paul H | last post by:
Can anyone give me some pointers as to how to construct a form or forms that will allow me to see a schedule of meeting rooms Booked or Available as a nice visual display. The Query that holds the data for the schedule will have the following fields: RoomName, StartDate, EndDate, BookedBy. It needs to look a bit like the Outlook calendar (not all users have Outlook), I do not need to see the times that rooms are booked/available, I just...
3
4146
by: mochatrpl | last post by:
I am looking for a way to make a query / report display the running average for total dollars. I have already set up a query to provide totals dollars per day from which a report graphly shows the dollars per week. How do I then take the dollars and get a running average for the year? - Randy
0
1065
by: Cameron Laird | last post by:
QOTW: "The users." - Ali, answering a question on what's special about Emacs. "Dynamic languages look at WSDL and shrug - another example of the hoops that static typing forces humans to go through." - Gordon Weakliem http://lists.community.tummy.com/pipermail/frpythoneers/2007-April/001342.html The current issue of the rather prestigious *Computing in Science and Engineering* journal is devoted to Python (!):...
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10666
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10351
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4140
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.