ik heb een script gevonden dan een "standaard" overzicht genereert, maar dan krijg je een outlook achtig kalendertje..
nu wil ik een lijst die per dag een nieuwe row begint, en dan na de 7e dag weer opnieuw begint.. das lastig.. heb je een tip ? :
<script language="JavaScript">
function Calendar(month, year)
{
this.days = new Array("Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday");
// array of month names
this.months = new Array("January", "February", "March", "April", "May",
"June", "July", "August", "September", "October", "November", "December");
// array of total days in each month
this.totalDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
// object properties - month and year
// correction for zero-based array index
this.month = month-1;
this.year = year;
// leap year correction
if (this.year % 4 == 0)
{
this.totalDays[1] = 29;
}
// temporary variable - used later
this.rowCount = 0;
// object method
this.display = display;
// automatically run method display() once object is initialized
this.display();
}
// function to display calendar
function display()
{
// create a Date object
// required to obtain basic date information
// get the first and last day of the month - boundary values for calendar
obj = new Date(this.year, this.month, 1);
this.firstDayOfMonth = obj.getDay();
obj.setDate(31);
this.lastDayOfMonth = obj.getDay();
// start table
document.write("<table border=0 cellpadding=2 cellspacing=5>");
// month display
document.write("<tr><td colspan=7 align=center><font face=Arial size=-1><b>" + this.months[this.month] + " " + this.year +
"</b></font></td></tr>");
// day names
document.write("<tr>");
for (x=0; x<7; x++)
{
document.write("<td><font face=Arial size=-2>" +
this.days[x].substring(0,3) + "</font></td>") ;
}
document.write("</tr>");
// start displaying dates
// display blank spaces until the first day of the month
document.write("<tr>");
for (x=1; x<=this.firstDayOfMonth; x++)
{
// this comes in handy to find the end of each 7-day block
this.rowCount++;
document.write("<td><font face=Arial size=-2> </font></td>");
}
// counter to track the current date
this.dayCount=1;
while (this.dayCount <= this.totalDays[this.month])
{
if (this.rowCount % 7 == 0)
{
document.write("</tr>\n<tr>");
}
// print date
document.write("<td align=center><font face=Arial size=-1>" + this.dayCount
+ "</font></td>");
this.dayCount++;
this.rowCount++;
}
// end table
document.write("</tr></table>");
}
// eof
</script>
[
Voor 20% gewijzigd door
whitehouse op 01-04-2004 19:41
]