Source
<script language="JavaScript1.1">
<!--
var TIME = " 8:00"; // time
of day the event ends - include leading space
// Both Day of week & month
are zero based in the date object.
// Array object forces use of JavaScript
1.1.
var dayStr = new
Array ("Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat.");
var monthStr = new Array
("Jan.", "Feb.", "Mar.", "Apr.", "May", "June",
"July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec.");
// Return day and month
function ddmmm(date) {
return date.getDate()
+ " " + monthStr[date.getMonth()];
}
// Return month and day
function mmmdd(date) {
return monthStr[date.getMonth()]
+ " " + date.getDate();
}
// Return two digit year with leading
blank
function yy(date) {
var year = date.getYear()
% 100;
var temp = (year
< 10) ? " 0" : " ";
return temp + year;
}
// Return four digit year with leading
blank
function yyyy(date) {
return " " + (1900
+ date.getYear());
}
//If the event hasn't passed, display
a row in the table.
function Row(day, description)
{
var event = new
Date(day + TIME);
var now
= new Date();
if (now.getTime()
< event.getTime()) {
with
(document) {
write("<tr valign=top><td>");
write(mmmdd(event));
write("</td><td>-</td><td>");
write(description);
write("</td></tr>\n");
}
}
}
//-->
</script>
<script language="JavaScript1.1">
<!--
document.write("<table
border=0>\n");
Row("11/28/2001", "Last week");
Row("12/05/2001", "This week");
Row("12/12/2001", "Next week");
Row("12/19/2001", "Two weeks
away");
document.write("</table>\n");
//-->
</script> |
|
Example Output
Dec. 12 - Next week
Dec. 19 - Two weeks away |