Highlighting Expired and New Events
This rather unique script allows you to keep a list of events "fresh" by changing the graphic in front of each event as it happens. I'm using little "stop" and "go" signs here, but any two graphics of a similar size can be used. It is Y2K compliant.
Our goal:
This will be old on March 1, 2002.
This will be old on April 4, 2002.
This will be old on October 1, 2002.
This will be old on December 31, 2003.
|
This first section of the script can go between the <HEAD> and </HEAD> tags. Stuff in blue must be changed to the location and names of your graphics; stuff in this color can be altered to align graphics properly.
<SCRIPT language=JavaScript>
<!--
/* This JavaScript was composed by Kristin J. Johnson.
*The Wererat's Lair: https://wererat.net/ */
var image = "images/old.gif"
var image2 = "images/new.gif"
function oldnews(when) {
when = new Date(when)
date = new Date();
if (when.getTime() < date.getTime()) {
document.write("<img src="+image+" ALIGN='texttop'> ")
}else document.write("<img src="+image2+" ALIGN='texttop'> ")
}
//-->
</SCRIPT>
|
This part of the script can go between the <BODY> and </BODY> tags. Stuff in blue must be changed to your "expiration" date, stuff in this color represents your text. If you have more than two events, simply add another chunk of the script below as needed; I've just shown two here, with a paragraph tag to separate them, to get you started.
<SCRIPT language=JavaScript>
<!--
oldnews("4/4/2002")
//-->
</SCRIPT>
This will be old on April 4, 2002
<P>
<SCRIPT language=JavaScript>
<!--
oldnews("12/31/2003")
//-->
</SCRIPT>
This will be old on December 31, 2003.
|
Grab a text file of this JavaScript (right-click and save it as a text file).
Grab a copy of the "Basic Buttons" font used for the
and
graphics.