T
Treetop
I have a script for my church that we use for the weekly events. I
currently have it as week of Feb 1, 2003 at the top, then list Sun -
Sat below the date. I have been asked to put the date next to each
day of the week.
I want to have the Month and Day after the day of the week. My
problem is during transition weeks, from one month to the next, that I
cannot figure out how to have it know to start over with day 1 on the
next month.
my files/scripts are -
caltext.html
---------------------------
<table bgcolor="eeeeff" width="200" border="0">
<tr><td colspan="2">
<script language="JavaScript" src="weekchoose.js">
</script></td></tr>
<script language="JavaScript" src="week.js"></script>
<tr><td colspan="2"><a href="cal.html">
Next week >></a></td></tr>
</table>
weekchoose.js
---------------------------
var kw=new Array();
kw[2]=new Array("2004/2/1","2004/2/7","1");
kw[1]=new Array("2004/2/8","2004/2/14","2");
kw[0]=new Array("2004/2/15","2004/2/21","3");
var today = new Date();
var ct = 0;
var dayarray=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var montharray=new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov
","Dec")
for (var i=kw.length-1;i>=0;i--)
{
var date = new Date(kw[1])
var date2 = new Date(kw[0])
var year = 1900 + date.getYear()%1900 // < AD 3800
var year2 = 1900 + date2.getYear()%1900 // < AD 3800
if (ct < 1) {
if (today.getTime() <= date.getTime()) {
ct = ct + 1
document.write('<center>Church Events for the Week of<br>'+
'<b>' + dayarray[date2.getDay()]+', '+
montharray[date2.getMonth()]+' '+date2.getDate()+',
'+year+'</b></center>');
document.write('<script language=JavaScript src=week/'
+ kw[2] + '.js></script>');
}
var ds = date2
}
}
week.js
---------------------------
document.write('<tr><td colspan="2"><b>Sunday</b></td></tr>'+
'<tr><td> </td><td>'+sun+'</td></tr>');
document.write('<tr><td colspan="2"><b>Monday</b></td></tr>'+
'<tr><td> </td><td>'+mon+'</td></tr>');
document.write('<tr><td colspan="2"><b>Tuesday</b></td></tr>'+
'<tr><td> </td><td>'+tue+'</td></tr>');
document.write('<tr><td colspan="2"><b>Wednesday</b></td></tr>'+
'<tr><td> </td><td>'+wed+'</td></tr>');
document.write('<tr><td colspan="2"><b>Thursday</b></td></tr>'+
'<tr><td> </td><td>'+thu+'</td></tr>');
document.write('<tr><td colspan="2"><b>Friday</b></td></tr>'+
'<tr><td> </td><td>'+fri+'</td></tr>');
document.write('<tr><td colspan="2"><b>Saturday</b></td></tr>'+
'<tr><td> </td><td>'+sat+'</td></tr>');
currently have it as week of Feb 1, 2003 at the top, then list Sun -
Sat below the date. I have been asked to put the date next to each
day of the week.
I want to have the Month and Day after the day of the week. My
problem is during transition weeks, from one month to the next, that I
cannot figure out how to have it know to start over with day 1 on the
next month.
my files/scripts are -
caltext.html
---------------------------
<table bgcolor="eeeeff" width="200" border="0">
<tr><td colspan="2">
<script language="JavaScript" src="weekchoose.js">
</script></td></tr>
<script language="JavaScript" src="week.js"></script>
<tr><td colspan="2"><a href="cal.html">
Next week >></a></td></tr>
</table>
weekchoose.js
---------------------------
var kw=new Array();
kw[2]=new Array("2004/2/1","2004/2/7","1");
kw[1]=new Array("2004/2/8","2004/2/14","2");
kw[0]=new Array("2004/2/15","2004/2/21","3");
var today = new Date();
var ct = 0;
var dayarray=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var montharray=new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov
","Dec")
for (var i=kw.length-1;i>=0;i--)
{
var date = new Date(kw[1])
var date2 = new Date(kw[0])
var year = 1900 + date.getYear()%1900 // < AD 3800
var year2 = 1900 + date2.getYear()%1900 // < AD 3800
if (ct < 1) {
if (today.getTime() <= date.getTime()) {
ct = ct + 1
document.write('<center>Church Events for the Week of<br>'+
'<b>' + dayarray[date2.getDay()]+', '+
montharray[date2.getMonth()]+' '+date2.getDate()+',
'+year+'</b></center>');
document.write('<script language=JavaScript src=week/'
+ kw[2] + '.js></script>');
}
var ds = date2
}
}
week.js
---------------------------
document.write('<tr><td colspan="2"><b>Sunday</b></td></tr>'+
'<tr><td> </td><td>'+sun+'</td></tr>');
document.write('<tr><td colspan="2"><b>Monday</b></td></tr>'+
'<tr><td> </td><td>'+mon+'</td></tr>');
document.write('<tr><td colspan="2"><b>Tuesday</b></td></tr>'+
'<tr><td> </td><td>'+tue+'</td></tr>');
document.write('<tr><td colspan="2"><b>Wednesday</b></td></tr>'+
'<tr><td> </td><td>'+wed+'</td></tr>');
document.write('<tr><td colspan="2"><b>Thursday</b></td></tr>'+
'<tr><td> </td><td>'+thu+'</td></tr>');
document.write('<tr><td colspan="2"><b>Friday</b></td></tr>'+
'<tr><td> </td><td>'+fri+'</td></tr>');
document.write('<tr><td colspan="2"><b>Saturday</b></td></tr>'+
'<tr><td> </td><td>'+sat+'</td></tr>');