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
[code=javascript]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>sayhi</title>
<link href="styleshee t.css" rel="stylesheet " type="text/css" />
<script language="JavaS cript" type="text/javascript" src="events.js" ></script>
<script type="text/JavaScript" language="JavaS cript">
var thisDate = 1; // Tracks current date being written in calendar
var wordMonth = new Array("January" ,"February","Ma rch","April","M ay","June","Jul y","August","Se ptember","Octob er","November", "December") ;
var today = new Date(); // Date object to store the current date
var todaysDay = today.getDay() + 1; // Stores the current day number 1-7
var todaysDate = today.getDate() ; // Stores the current numeric date within the month
var todaysMonth = today.getUTCMon th() + 1; // Stores the current month 1-12
var todaysYear = today.getFullYe ar(); // Stores the current year
var monthNum = todaysMonth; // Tracks the current month being displayed
var yearNum = todaysYear; // Tracks the current year being displayed
var firstDate = new Date(String(mon thNum)+"/1/"+String(yearNu m)); // Object Storing the first day of the current month
var firstDay = firstDate.getUT CDay(); // Tracks the day number 1-7 of the first day of the current month
var lastDate = new Date(String(mon thNum+1)+"/0/"+String(yearNu m)); // Tracks the last date of the current month
var numbDays = 0;
var calendarString = "";
var eastermonth = 0;
var easterday = 0;
var date =0;
var event8="";
var events1="hello" ;
events = new Array(
["Y", "11", "8", "2008", "1:00 AM", "12:59 PM", "beautiful day", "aweewwewweewew eww"],
["Y", "11", "22", "2008", "1:00 AM", "12:59 PM", "beautiful days", "wewewewewewqwe wwew"],
["Y", "11", "8", "2008", "1:00 AM", "12:59 PM", "rrrrrrr", "rrrrrrr"],
["Y", "11", "22", "2006", "1:00 AM", "12:59 PM", "wwwwww", "wwwwww"],
["Y", "11", "8", "2006", "1:00 AM", "12:59 PM", "avvvvvvvvv ", "avvvvvvvvv "],
["Y", "11", "22", "2005", "1:00 AM", "12:59 PM", "ssssssssss ", "ssssssssss "],
["Y", "11", "8", "2005", "1:00 AM", "12:59 PM", "zzzzzzzzz" , "zzzzzzzzz"],
["Y", "11", "22", "2009", "1:00 AM", "12:59 PM", "ddddddd", "ddddddd"],
["Y", "11", "8", "2009", "1:00 AM", "12:59 PM", "hhhhhhhh", "hhhhhhhh"],
["Y", "11", "22", "2010", "1:00 AM", "12:59 PM", "vvvvvvv", "vvvvvvv"],
["Y", "11", "8", "2010", "1:00 AM", "12:59 PM", "bbbbbbbb", "bbbbbbbb"],
["Y", "10", "1", "2011", "1:00 AM", "12:59 PM", "kkkkkkk", "kkkkkkk"],
["Y", "10", "2", "2011", "1:00 AM", "12:59 PM", "xxxxxxxxxx ", "xxxxxxxxxx "],
["Y", "9", "9", "2007", "1:00 AM", "12:59 PM", "vvvvvvvvvv ", "vvvvvvvvvv "],
["Y", "9", "8", "2007", "1:00 AM", "12:59 PM", "cccccccccc c", "cccccccccc c"],
["Y", "11", "2", "2006", "1:00 AM", "12:59 PM", "wbbbbbbbbb b", "wbbbbbbbbb b"],
["Y", "11", "3", "2006", "1:00 AM", "12:59 PM", "nnnnnnnnnnnnnn ", "nnnnnnnnnnnnnn "],
["Y", "11", "22", "2005", "1:00 AM", "12:59 PM", "jjjjjjjjjj ", "jjjjjjjjjj "],
["Y", "11", "8", "2005", "1:00 AM", "12:59 PM", "oooooo", "oooooo"],
["Y", "11", "22", "2004", "1:00 AM", "12:59 PM", "hhhhh", "hhhhh"],
["Y", "11", "8", "2004", "1:00 AM", "12:59 PM", "vbvbvn", "vbvbvn"],
["Y", "10", "22", "2008", "1:00 AM", "12:59 PM", "uuuuuu", "uuuuuu"],
["Y", "10", "8", "2008", "1:00 AM", "12:59 PM", "llkuiiu", "llkuiiu"],
["Y", "12", "22", "2008", "1:00 AM", "12:59 PM", "ghjhj", "ghjhj"],
["Y", "12", "8", "2008", "1:00 AM", "12:59 PM", "awee", "awee"],
["Y", "11", "23", "2008", "1:00 AM", "12:59 PM", "ewewqwewwe w", "ewewqwewwe w"],
["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."],
["F", "1", "3", "2", "1:00 AM", "12:59 PM", "Martin Luther King Day", "Honors civil rights leader Rev Martin Luther King."],
["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."],
["Y", "2", "14", "2005", "1:00 AM", "12:59 PM", "Valentine' s Day", "Traditiona l celebration of love and romance, including the exchange of cards, candy, flowers, and other gifts."],
["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."],
["F", "3", "0", "0", "1:00 AM", "12:59 PM", "Easter", "Traditiona l celebration of the resurrection of Jesus Christ."],
["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')."],
["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."],
["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."],
["F", "5", "2", "1", "1:00 AM", "12:59 PM", "Mother's Day", "Honors mothers and motherhood (made a Federal Holiday by Presidential order)."],
["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."],
["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."],
["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."],
["F", "6", "3", "1", "1:00 AM", "12:59 PM", "Father's Day", "Honors all Fathers and fatherhood."],
["Y", "7", "4", "2005", "1:00 AM", "12:59 PM", "Independen ce Day", "Celebrates our Declaration of Independence from England in 1776, usually called the Fourth of July."],
["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."],
["F", "10", "2", "2", "1:00 AM", "12:59 PM", "Columbus' Day", "Honors the traditional discovery of the Americas by Christopher Columbus."],
["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."],
["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."],
["F", "11", "4", "5", "1:00 AM", "12:59 PM", "Thanksgivi ng", "A day to give thanks for your many blessings - traditionally for the Autumn harvest, and it marks the beginning of the 'holiday season'."],
["Y", "12", "25", "2009", "1:00 AM", "12:59 PM", "Christmas" , "Celebratio n of the traditional day of Jesus' birth - God was made flesh and dwelt among us."]
// Please omit the final comma after the ] from the last line above unless you are going to add another event at this time.
);
function events1(event8)
{
return event8;
}
function prod(date1,date 2)
{
x=date1;
this.date2=date 2;
this.date1=date 1;
return x;
}
var events2=prod("h i","11");
var house1=new prod("hello","1 1");
document.write( daycounter);
function changedate(butt onpressed) {
if (buttonpressed == "prevyr") yearNum--;
else if (buttonpressed == "nextyr") yearNum++;
else if (buttonpressed == "prevmo") monthNum--;
else if (buttonpressed == "nextmo") monthNum++;
else if (buttonpressed == "nextmo1") {
monthNum=docume nt.getElementBy Id("select3");
}
else if (buttonpressed == "return") {
monthNum = todaysMonth;
yearNum = todaysYear;
}
if (monthNum == 0) {
monthNum = 12;
yearNum--;
}
else if (monthNum == 13) {
monthNum = 1;
yearNum++
}
lastDate = new Date(String(mon thNum+1)+"/0/"+String(yearNu m));
numbDays = lastDate.getDat e();
firstDate = new Date(String(mon thNum)+"/1/"+String(yearNu m));
firstDay = firstDate.getDa y() + 1;
createCalendar( );
return;
}
function easter(year) {
// feed in the year it returns the month and day of Easter using two GLOBAL variables: eastermonth and easterday
var a = year % 19;
var b = Math.floor(year/100);
var c = year % 100;
var d = Math.floor(b/4);
var e = b % 4;
var f = Math.floor((b+8 ) / 25);
var g = Math.floor((b-f+1) / 3);
var h = (19*a + b - d - g + 15) % 30;
var i = Math.floor(c/4);
var j = c % 4;
var k = (32 + 2*e + 2*i - h - j) % 7;
var m = Math.floor((a + 11*h + 22*k) / 451);
var month = Math.floor((h + k - 7*m + 114) / 31);
var day = ((h + k - 7*m +114) % 31) + 1;
eastermonth = month;
easterday = day;
}
function createCalendar( ) {
calendarString = '';
var daycounter = 0;
calendarString +='<tr>';
calendarString +='<td class=\"tdpad\" colspan=\"2\">' ;
calendarString +='<table width=\"741\" border=\"0\" align=\"center\ " cellpadding=\"0 \" cellspacing=\"0 \">';
calendarString +='<tr>';
calendarString +='<td height=\"20\" colspan=\"4\" valign=\"top\"> <a class=\"breadli nk\" href=\"#\">Home </a> - Calender of Events</td>';
calendarString +='</tr>';
calendarString +='<tr>';
calendarString +='<td width=\"21%\" height=\"30\">< font class=\"calende r\">'+ wordMonth[monthNum-1]+ yearNum+'</font></td>';
calendarString +='<td colspan=\"3\" align=\"right\" >';
calendarString +='<input class=\"btn2\" type=\"submit\" name=\"Submit\" value=\"Import Events\" />';
calendarString +='<input class=\"btn2\" type=\"submit\" name=\"Submit2\ " value=\"Open Window\" />';
calendarString +='</td>';
calendarString +='</tr>';
calendarString +='<tr>';
calendarString +='<td height=\"30\">< a href=\"#\" class=\"etext\" >Month</a> - <a href=\"#\" class=\"etext\" >Week</a> - <a href=\"#\" class=\"etext\" >Day</a></td>';
calendarString +='<td width=\"47%\" align=\"center\ ">';
calendarString +='<a class=\"etext\" href=\"#\" onClick=\"chang edate(\'prevmo\ ')\"><<&l t; Previous</a>';
calendarString +='<select name=\"select3\ " id=\"select3\" onChange=\"chan gedate(\'nextmo 1\')\">';
calendarString +='<option value='+ wordMonth[monthNum-1]+'>'+ wordMonth[monthNum-1]+'</option>';
calendarString +='<option value='+ wordMonth[monthNum-2]+'>'+ wordMonth[monthNum-2]+'</option>';
calendarString +='<option value='+ wordMonth[monthNum-3]+'>'+ wordMonth[monthNum-3]+'</option>';
calendarString +='<option value='+ wordMonth[monthNum-4]+'>'+ wordMonth[monthNum-4]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-5]+'>'+ wordMonth[monthNum-5]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-6]+'>'+ wordMonth[monthNum-6]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-7]+'>'+ wordMonth[monthNum-7]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-8]+'>'+ wordMonth[monthNum-8]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-9]+'>'+ wordMonth[monthNum-9]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-10]+'>'+ wordMonth[monthNum-10]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-11]+'>'+ wordMonth[monthNum-11]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum]+'>'+ wordMonth[monthNum]+'</option>';
calendarString +='</select>';
calendarString +='<select name=\"select4\ ">';
calendarString +='<option>'+ yearNum+'</option>';
calendarString +='</select>';
calendarString +='<a class=\"etext\" href=\"#\" onClick=\"chang edate(\'nextyr\ ')\">Next >>> </a>';
calendarString +='</td>';
calendarString +='<td width=\"27%\">' ;
calendarString +='<a href=\"#\" class=\"etext\" >Login</a> - <a href=\"#\" class=\"etext\" >Search</a>';
calendarString +='<select name=\"select\" >';
calendarString +='<option>Hi-Radar Events</option>';
calendarString +='</select>';
calendarString +='</td>';
calendarString +='<td>';
calendarString +='<input name=\"image\" type=\"image\" value=\"Submit\ " src=\"http://bytes.com/images/search.gif\" />';
calendarString +='</td>';
calendarString +='</tr>';
calendarString +='</table>';
calendarString +='</td>';
calendarString += '</tr>';
calendarString += '<tr>';
calendarString += '<td style=\"padding-right:12px;\" height=\"26\" align=\"right\" ><a class=\"elink\" href=\"#\">View Open-Win</a> - <a class=\"elink\" href=\"#\">Mana ge Open-Win</a> - <a class=\"elink\" href=\"#\">Brow se Open-Win</a> - <a class=\"elink\" href=\"#\">View My Bookmark</a></td>';
calendarString +='</tr>';
calendarString += '<table width="741" height="630" border="0" cellpadding="0" cellspacing="1" >';
calendarString += '<tr>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Sunday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Monday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Tuesday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Wednesday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Thursday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Friday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Saturday</td>';
calendarString += '</tr>';
thisDate == 1;
for (var i = 1; i <= 6; i++) {
calendarString += '<tr>';
for (var x = 1; x <= 7; x++) {
daycounter = (thisDate - firstDay)+1;
thisDate++;
if ((daycounter > numbDays) || (daycounter < 1)) {
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">& nbsp;<\/td>';
} else {
if (checkevents(da ycounter,monthN um,yearNum,i,x) || ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum))){
if ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum)) {
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">& nbsp</td>';
}
else{
var showevent=showe vents(daycounte r,monthNum,year Num,"i","x");
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">' + showevent + daycounter + '<\/td>';
var showevent=showe vents(daycounte r,monthNum,year Num,"i","x");
}
} else {
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">' + daycounter + '<\/td>';
}
}
}
calendarString += '<\/tr>';
}
'<\/table>';
var object=document .getElementById ('calendar');
object.innerHTM L= calendarString;
thisDate = 1;
}
function checkevents(day ,month,year,wee k,dayofweek) {
var numevents = 0;
var floater = 0;
for (var i = 0; i < events.length; i++) {
if (events[0][0] == "W") {
if ((events[0][2] == dayofweek)) numevents++;
}
else if (events[0][0] == "Y") {
if ((events[0][2] == day) && (events[0][1] == month) && (events[0][3] == year) ) numevents++;
}
else if (events[0][0] == "F") {
if ((events[0][1] == 3) && (events[0][2] == 0) && (events[0][3] == 0) ) {
easter(year);
if (easterday == day && eastermonth == month) numevents++;
} else {
floater = floatingholiday (year,events[i][1],events[i][2],events[i][3]);
if ((month == 5) && (events[i][1] == 5) && (events[i][2] == 4) && (events[i][3] == 2)) {
if ((floater + 7 <= 31) && (day == floater + 7)) {
numevents++;
} else if ((floater + 7 > 31) && (day == floater)) numevents++;
} else if ((events[0][1] == month) && (floater == day)) numevents++;
}
}
else if ((events[0][2] == day) && (events[0][1] == month) && (events[0][3] == year)) {
numevents++;
}
}
if (numevents == 0) {
return false;
} else {
return true;
}
}
function showevents(day, month,year,week ,dayofweek) {
var theevent = "";
var floater = 0;
var eventhan="ww";
for (var i = 0; i < events.length; i++) {
if (events[i][0] != "") {
// First we'll process recurring events (if any):
if (events[i][0] == "Y") {
if ((events[i][2]==day) && (events[i][1] == month) && (events[i][3] == year) ) {
theevent += events[i][6] + '\n';
theevent += '\n -------------- \n\n';
return theevent;
}
}
}
}
}
function floatingholiday (targetyr,targe tmo,cardinalocc urrence,targetd ay) {
// Floating holidays/events of the events.js file uses:
// the Month field for the Month (here it becomes the targetmo field)
// the Day field as the Cardinal Occurrence (here it becomes the cardinaloccurre nce field)
// 1=1st, 2=2nd, 3=3rd, 4=4th, 5=5th, 6=6th occurrence of the day listed next
// the Year field as the Day of the week the event/holiday falls on (here it becomes the targetday field)
// 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thurday, 6=Friday, 7=Saturday
// example: "F", "1", "3", "2", = Floating holiday in January on the 3rd Monday of that month.
//
// In our code below:
// targetyr is the active year
// targetmo is the active month (1-12)
// cardinaloccurre nce is the xth occurrence of the targetday (1-6)
// targetday is the day of the week the floating holiday is on
// 0=Sun; 1=Mon; 2=Tue; 3=Wed; 4=Thu; 5=Fri; 6=Sat
// Note: subtract 1 from the targetday field if the info comes from the events.js file
//
// Note:
// If Memorial Day falls on the 22nd, 23rd, or 24th, then we add 7 to the dayofmonth to the result.
//
// Example: targetyr = 2052; targetmo = 5; cardinaloccurre nce = 4; targetday = 1
// This is the same as saying our floating holiday in the year 2052, is during May, on the 4th Monday
//
var firstdate = new Date(String(tar getmo)+"/1/"+String(target yr)); // Object Storing the first day of the current month.
var firstday = firstdate.getUT CDay(); // The first day (0-6) of the target month.
var dayofmonth = 0; // zero out our calendar day variable.
targetday = targetday - 1;
if (targetday >= firstday) {
cardinaloccurre nce--; // Subtract 1 from cardinal day.
dayofmonth = (cardinaloccurr ence * 7) + ((targetday - firstday)+1);
} else {
dayofmonth = (cardinaloccurr ence * 7) + ((targetday - firstday)+1);
}
return dayofmonth;
}
</script>
</head>
<body class="homebg" onload="changed ate('return')">
<%@ include file="includes/header.jsp" %>
<table width="781" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td class="intab" align="left" valign="top"><t able width="765" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td class="tdpad2" align="left" valign="top">
<center>
<table id="evtcal" border="0" cellpadding="0" cellspacing="0" width="584">
<tbody>
<tr>
<td style="padding: 3px;" align="center" bgcolor="#FFFFF F" valign="top" width="314">
<div id="calendar">< !-- Dynamically Filled --></div>
</td>
<td width="10">&nbs p;</td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</table></td>
</tr>
</table>
<%@ include file="includes/footer.jsp" %>
</body>
</html>
[/code]
i want the daily,weekly calendar .plz suggest how i made changes into that code.
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
[code=javascript]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>sayhi</title>
<link href="styleshee t.css" rel="stylesheet " type="text/css" />
<script language="JavaS cript" type="text/javascript" src="events.js" ></script>
<script type="text/JavaScript" language="JavaS cript">
var thisDate = 1; // Tracks current date being written in calendar
var wordMonth = new Array("January" ,"February","Ma rch","April","M ay","June","Jul y","August","Se ptember","Octob er","November", "December") ;
var today = new Date(); // Date object to store the current date
var todaysDay = today.getDay() + 1; // Stores the current day number 1-7
var todaysDate = today.getDate() ; // Stores the current numeric date within the month
var todaysMonth = today.getUTCMon th() + 1; // Stores the current month 1-12
var todaysYear = today.getFullYe ar(); // Stores the current year
var monthNum = todaysMonth; // Tracks the current month being displayed
var yearNum = todaysYear; // Tracks the current year being displayed
var firstDate = new Date(String(mon thNum)+"/1/"+String(yearNu m)); // Object Storing the first day of the current month
var firstDay = firstDate.getUT CDay(); // Tracks the day number 1-7 of the first day of the current month
var lastDate = new Date(String(mon thNum+1)+"/0/"+String(yearNu m)); // Tracks the last date of the current month
var numbDays = 0;
var calendarString = "";
var eastermonth = 0;
var easterday = 0;
var date =0;
var event8="";
var events1="hello" ;
events = new Array(
["Y", "11", "8", "2008", "1:00 AM", "12:59 PM", "beautiful day", "aweewwewweewew eww"],
["Y", "11", "22", "2008", "1:00 AM", "12:59 PM", "beautiful days", "wewewewewewqwe wwew"],
["Y", "11", "8", "2008", "1:00 AM", "12:59 PM", "rrrrrrr", "rrrrrrr"],
["Y", "11", "22", "2006", "1:00 AM", "12:59 PM", "wwwwww", "wwwwww"],
["Y", "11", "8", "2006", "1:00 AM", "12:59 PM", "avvvvvvvvv ", "avvvvvvvvv "],
["Y", "11", "22", "2005", "1:00 AM", "12:59 PM", "ssssssssss ", "ssssssssss "],
["Y", "11", "8", "2005", "1:00 AM", "12:59 PM", "zzzzzzzzz" , "zzzzzzzzz"],
["Y", "11", "22", "2009", "1:00 AM", "12:59 PM", "ddddddd", "ddddddd"],
["Y", "11", "8", "2009", "1:00 AM", "12:59 PM", "hhhhhhhh", "hhhhhhhh"],
["Y", "11", "22", "2010", "1:00 AM", "12:59 PM", "vvvvvvv", "vvvvvvv"],
["Y", "11", "8", "2010", "1:00 AM", "12:59 PM", "bbbbbbbb", "bbbbbbbb"],
["Y", "10", "1", "2011", "1:00 AM", "12:59 PM", "kkkkkkk", "kkkkkkk"],
["Y", "10", "2", "2011", "1:00 AM", "12:59 PM", "xxxxxxxxxx ", "xxxxxxxxxx "],
["Y", "9", "9", "2007", "1:00 AM", "12:59 PM", "vvvvvvvvvv ", "vvvvvvvvvv "],
["Y", "9", "8", "2007", "1:00 AM", "12:59 PM", "cccccccccc c", "cccccccccc c"],
["Y", "11", "2", "2006", "1:00 AM", "12:59 PM", "wbbbbbbbbb b", "wbbbbbbbbb b"],
["Y", "11", "3", "2006", "1:00 AM", "12:59 PM", "nnnnnnnnnnnnnn ", "nnnnnnnnnnnnnn "],
["Y", "11", "22", "2005", "1:00 AM", "12:59 PM", "jjjjjjjjjj ", "jjjjjjjjjj "],
["Y", "11", "8", "2005", "1:00 AM", "12:59 PM", "oooooo", "oooooo"],
["Y", "11", "22", "2004", "1:00 AM", "12:59 PM", "hhhhh", "hhhhh"],
["Y", "11", "8", "2004", "1:00 AM", "12:59 PM", "vbvbvn", "vbvbvn"],
["Y", "10", "22", "2008", "1:00 AM", "12:59 PM", "uuuuuu", "uuuuuu"],
["Y", "10", "8", "2008", "1:00 AM", "12:59 PM", "llkuiiu", "llkuiiu"],
["Y", "12", "22", "2008", "1:00 AM", "12:59 PM", "ghjhj", "ghjhj"],
["Y", "12", "8", "2008", "1:00 AM", "12:59 PM", "awee", "awee"],
["Y", "11", "23", "2008", "1:00 AM", "12:59 PM", "ewewqwewwe w", "ewewqwewwe w"],
["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."],
["F", "1", "3", "2", "1:00 AM", "12:59 PM", "Martin Luther King Day", "Honors civil rights leader Rev Martin Luther King."],
["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."],
["Y", "2", "14", "2005", "1:00 AM", "12:59 PM", "Valentine' s Day", "Traditiona l celebration of love and romance, including the exchange of cards, candy, flowers, and other gifts."],
["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."],
["F", "3", "0", "0", "1:00 AM", "12:59 PM", "Easter", "Traditiona l celebration of the resurrection of Jesus Christ."],
["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')."],
["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."],
["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."],
["F", "5", "2", "1", "1:00 AM", "12:59 PM", "Mother's Day", "Honors mothers and motherhood (made a Federal Holiday by Presidential order)."],
["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."],
["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."],
["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."],
["F", "6", "3", "1", "1:00 AM", "12:59 PM", "Father's Day", "Honors all Fathers and fatherhood."],
["Y", "7", "4", "2005", "1:00 AM", "12:59 PM", "Independen ce Day", "Celebrates our Declaration of Independence from England in 1776, usually called the Fourth of July."],
["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."],
["F", "10", "2", "2", "1:00 AM", "12:59 PM", "Columbus' Day", "Honors the traditional discovery of the Americas by Christopher Columbus."],
["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."],
["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."],
["F", "11", "4", "5", "1:00 AM", "12:59 PM", "Thanksgivi ng", "A day to give thanks for your many blessings - traditionally for the Autumn harvest, and it marks the beginning of the 'holiday season'."],
["Y", "12", "25", "2009", "1:00 AM", "12:59 PM", "Christmas" , "Celebratio n of the traditional day of Jesus' birth - God was made flesh and dwelt among us."]
// Please omit the final comma after the ] from the last line above unless you are going to add another event at this time.
);
function events1(event8)
{
return event8;
}
function prod(date1,date 2)
{
x=date1;
this.date2=date 2;
this.date1=date 1;
return x;
}
var events2=prod("h i","11");
var house1=new prod("hello","1 1");
document.write( daycounter);
function changedate(butt onpressed) {
if (buttonpressed == "prevyr") yearNum--;
else if (buttonpressed == "nextyr") yearNum++;
else if (buttonpressed == "prevmo") monthNum--;
else if (buttonpressed == "nextmo") monthNum++;
else if (buttonpressed == "nextmo1") {
monthNum=docume nt.getElementBy Id("select3");
}
else if (buttonpressed == "return") {
monthNum = todaysMonth;
yearNum = todaysYear;
}
if (monthNum == 0) {
monthNum = 12;
yearNum--;
}
else if (monthNum == 13) {
monthNum = 1;
yearNum++
}
lastDate = new Date(String(mon thNum+1)+"/0/"+String(yearNu m));
numbDays = lastDate.getDat e();
firstDate = new Date(String(mon thNum)+"/1/"+String(yearNu m));
firstDay = firstDate.getDa y() + 1;
createCalendar( );
return;
}
function easter(year) {
// feed in the year it returns the month and day of Easter using two GLOBAL variables: eastermonth and easterday
var a = year % 19;
var b = Math.floor(year/100);
var c = year % 100;
var d = Math.floor(b/4);
var e = b % 4;
var f = Math.floor((b+8 ) / 25);
var g = Math.floor((b-f+1) / 3);
var h = (19*a + b - d - g + 15) % 30;
var i = Math.floor(c/4);
var j = c % 4;
var k = (32 + 2*e + 2*i - h - j) % 7;
var m = Math.floor((a + 11*h + 22*k) / 451);
var month = Math.floor((h + k - 7*m + 114) / 31);
var day = ((h + k - 7*m +114) % 31) + 1;
eastermonth = month;
easterday = day;
}
function createCalendar( ) {
calendarString = '';
var daycounter = 0;
calendarString +='<tr>';
calendarString +='<td class=\"tdpad\" colspan=\"2\">' ;
calendarString +='<table width=\"741\" border=\"0\" align=\"center\ " cellpadding=\"0 \" cellspacing=\"0 \">';
calendarString +='<tr>';
calendarString +='<td height=\"20\" colspan=\"4\" valign=\"top\"> <a class=\"breadli nk\" href=\"#\">Home </a> - Calender of Events</td>';
calendarString +='</tr>';
calendarString +='<tr>';
calendarString +='<td width=\"21%\" height=\"30\">< font class=\"calende r\">'+ wordMonth[monthNum-1]+ yearNum+'</font></td>';
calendarString +='<td colspan=\"3\" align=\"right\" >';
calendarString +='<input class=\"btn2\" type=\"submit\" name=\"Submit\" value=\"Import Events\" />';
calendarString +='<input class=\"btn2\" type=\"submit\" name=\"Submit2\ " value=\"Open Window\" />';
calendarString +='</td>';
calendarString +='</tr>';
calendarString +='<tr>';
calendarString +='<td height=\"30\">< a href=\"#\" class=\"etext\" >Month</a> - <a href=\"#\" class=\"etext\" >Week</a> - <a href=\"#\" class=\"etext\" >Day</a></td>';
calendarString +='<td width=\"47%\" align=\"center\ ">';
calendarString +='<a class=\"etext\" href=\"#\" onClick=\"chang edate(\'prevmo\ ')\"><<&l t; Previous</a>';
calendarString +='<select name=\"select3\ " id=\"select3\" onChange=\"chan gedate(\'nextmo 1\')\">';
calendarString +='<option value='+ wordMonth[monthNum-1]+'>'+ wordMonth[monthNum-1]+'</option>';
calendarString +='<option value='+ wordMonth[monthNum-2]+'>'+ wordMonth[monthNum-2]+'</option>';
calendarString +='<option value='+ wordMonth[monthNum-3]+'>'+ wordMonth[monthNum-3]+'</option>';
calendarString +='<option value='+ wordMonth[monthNum-4]+'>'+ wordMonth[monthNum-4]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-5]+'>'+ wordMonth[monthNum-5]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-6]+'>'+ wordMonth[monthNum-6]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-7]+'>'+ wordMonth[monthNum-7]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-8]+'>'+ wordMonth[monthNum-8]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-9]+'>'+ wordMonth[monthNum-9]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-10]+'>'+ wordMonth[monthNum-10]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum-11]+'>'+ wordMonth[monthNum-11]+'</option>';
calendarString +='<option name='+ wordMonth[monthNum]+'>'+ wordMonth[monthNum]+'</option>';
calendarString +='</select>';
calendarString +='<select name=\"select4\ ">';
calendarString +='<option>'+ yearNum+'</option>';
calendarString +='</select>';
calendarString +='<a class=\"etext\" href=\"#\" onClick=\"chang edate(\'nextyr\ ')\">Next >>> </a>';
calendarString +='</td>';
calendarString +='<td width=\"27%\">' ;
calendarString +='<a href=\"#\" class=\"etext\" >Login</a> - <a href=\"#\" class=\"etext\" >Search</a>';
calendarString +='<select name=\"select\" >';
calendarString +='<option>Hi-Radar Events</option>';
calendarString +='</select>';
calendarString +='</td>';
calendarString +='<td>';
calendarString +='<input name=\"image\" type=\"image\" value=\"Submit\ " src=\"http://bytes.com/images/search.gif\" />';
calendarString +='</td>';
calendarString +='</tr>';
calendarString +='</table>';
calendarString +='</td>';
calendarString += '</tr>';
calendarString += '<tr>';
calendarString += '<td style=\"padding-right:12px;\" height=\"26\" align=\"right\" ><a class=\"elink\" href=\"#\">View Open-Win</a> - <a class=\"elink\" href=\"#\">Mana ge Open-Win</a> - <a class=\"elink\" href=\"#\">Brow se Open-Win</a> - <a class=\"elink\" href=\"#\">View My Bookmark</a></td>';
calendarString +='</tr>';
calendarString += '<table width="741" height="630" border="0" cellpadding="0" cellspacing="1" >';
calendarString += '<tr>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Sunday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Monday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Tuesday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Wednesday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Thursday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Friday</td>';
calendarString += '<td width=\"106\" height=\"26\" align=\"center\ " bgcolor=\"#4F76 37\" class=\"font\"> Saturday</td>';
calendarString += '</tr>';
thisDate == 1;
for (var i = 1; i <= 6; i++) {
calendarString += '<tr>';
for (var x = 1; x <= 7; x++) {
daycounter = (thisDate - firstDay)+1;
thisDate++;
if ((daycounter > numbDays) || (daycounter < 1)) {
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">& nbsp;<\/td>';
} else {
if (checkevents(da ycounter,monthN um,yearNum,i,x) || ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum))){
if ((todaysDay == x) && (todaysDate == daycounter) && (todaysMonth == monthNum)) {
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">& nbsp</td>';
}
else{
var showevent=showe vents(daycounte r,monthNum,year Num,"i","x");
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">' + showevent + daycounter + '<\/td>';
var showevent=showe vents(daycounte r,monthNum,year Num,"i","x");
}
} else {
calendarString += '<td align=\"center\ " bgcolor=\"#F2F8 ED\" width=\"106\">' + daycounter + '<\/td>';
}
}
}
calendarString += '<\/tr>';
}
'<\/table>';
var object=document .getElementById ('calendar');
object.innerHTM L= calendarString;
thisDate = 1;
}
function checkevents(day ,month,year,wee k,dayofweek) {
var numevents = 0;
var floater = 0;
for (var i = 0; i < events.length; i++) {
if (events[0][0] == "W") {
if ((events[0][2] == dayofweek)) numevents++;
}
else if (events[0][0] == "Y") {
if ((events[0][2] == day) && (events[0][1] == month) && (events[0][3] == year) ) numevents++;
}
else if (events[0][0] == "F") {
if ((events[0][1] == 3) && (events[0][2] == 0) && (events[0][3] == 0) ) {
easter(year);
if (easterday == day && eastermonth == month) numevents++;
} else {
floater = floatingholiday (year,events[i][1],events[i][2],events[i][3]);
if ((month == 5) && (events[i][1] == 5) && (events[i][2] == 4) && (events[i][3] == 2)) {
if ((floater + 7 <= 31) && (day == floater + 7)) {
numevents++;
} else if ((floater + 7 > 31) && (day == floater)) numevents++;
} else if ((events[0][1] == month) && (floater == day)) numevents++;
}
}
else if ((events[0][2] == day) && (events[0][1] == month) && (events[0][3] == year)) {
numevents++;
}
}
if (numevents == 0) {
return false;
} else {
return true;
}
}
function showevents(day, month,year,week ,dayofweek) {
var theevent = "";
var floater = 0;
var eventhan="ww";
for (var i = 0; i < events.length; i++) {
if (events[i][0] != "") {
// First we'll process recurring events (if any):
if (events[i][0] == "Y") {
if ((events[i][2]==day) && (events[i][1] == month) && (events[i][3] == year) ) {
theevent += events[i][6] + '\n';
theevent += '\n -------------- \n\n';
return theevent;
}
}
}
}
}
function floatingholiday (targetyr,targe tmo,cardinalocc urrence,targetd ay) {
// Floating holidays/events of the events.js file uses:
// the Month field for the Month (here it becomes the targetmo field)
// the Day field as the Cardinal Occurrence (here it becomes the cardinaloccurre nce field)
// 1=1st, 2=2nd, 3=3rd, 4=4th, 5=5th, 6=6th occurrence of the day listed next
// the Year field as the Day of the week the event/holiday falls on (here it becomes the targetday field)
// 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thurday, 6=Friday, 7=Saturday
// example: "F", "1", "3", "2", = Floating holiday in January on the 3rd Monday of that month.
//
// In our code below:
// targetyr is the active year
// targetmo is the active month (1-12)
// cardinaloccurre nce is the xth occurrence of the targetday (1-6)
// targetday is the day of the week the floating holiday is on
// 0=Sun; 1=Mon; 2=Tue; 3=Wed; 4=Thu; 5=Fri; 6=Sat
// Note: subtract 1 from the targetday field if the info comes from the events.js file
//
// Note:
// If Memorial Day falls on the 22nd, 23rd, or 24th, then we add 7 to the dayofmonth to the result.
//
// Example: targetyr = 2052; targetmo = 5; cardinaloccurre nce = 4; targetday = 1
// This is the same as saying our floating holiday in the year 2052, is during May, on the 4th Monday
//
var firstdate = new Date(String(tar getmo)+"/1/"+String(target yr)); // Object Storing the first day of the current month.
var firstday = firstdate.getUT CDay(); // The first day (0-6) of the target month.
var dayofmonth = 0; // zero out our calendar day variable.
targetday = targetday - 1;
if (targetday >= firstday) {
cardinaloccurre nce--; // Subtract 1 from cardinal day.
dayofmonth = (cardinaloccurr ence * 7) + ((targetday - firstday)+1);
} else {
dayofmonth = (cardinaloccurr ence * 7) + ((targetday - firstday)+1);
}
return dayofmonth;
}
</script>
</head>
<body class="homebg" onload="changed ate('return')">
<%@ include file="includes/header.jsp" %>
<table width="781" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td class="intab" align="left" valign="top"><t able width="765" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td class="tdpad2" align="left" valign="top">
<center>
<table id="evtcal" border="0" cellpadding="0" cellspacing="0" width="584">
<tbody>
<tr>
<td style="padding: 3px;" align="center" bgcolor="#FFFFF F" valign="top" width="314">
<div id="calendar">< !-- Dynamically Filled --></div>
</td>
<td width="10">&nbs p;</td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</table></td>
</tr>
</table>
<%@ include file="includes/footer.jsp" %>
</body>
</html>
[/code]
i want the daily,weekly calendar .plz suggest how i made changes into that code.
Comment