New Flag

This code snippet displays a new graphic for a specified amount of time.  The example below will display the new graphic for 28 days after Janurary 31st, 1998.

To use, copy the first snippet and place it into the hearder of your docuement.  Next, copy the next snippet and place it where you want the graphic to appear.  Last, copy the graphic (New).  (With many browsers, you can right click on the icon.)

<SCRIPT language= "JavaScript">
<!--
/*
 * By Mattias Sjoberg 2/18-96.  You're welcome to use/edit the function
 * isnew().  Keep the comments and drop me a note.
 * mattias.sjoberg@swipnet.se  www.oocities.org/SiliconValley/7116
 * Modified by Rick.Clements@worldnet.att.net www.oocities.org/Athens/Acropolis/3558/
 *
 * Purpose: Display the new graphic for a number of days.
 * Input:   maxdays - days to display the graphic
 *          addDate - Date the material was added (mm/dd/yy).
 */
function isnew(maxdays, addDate){
  var oldDate = new Date(addDate);
  var newDate = new Date();
  var maxmsec = maxdays*24*60*60*1000;

  if ((newDate.getTime()-oldDate.getTime()) <=  maxmsec) {
    document.write("<img src=img/new2.gif width=32 height=16 Alt='(New)'>");
  }
}
//-->
</SCRIPT>

<SCRIPT language=JavaScript>
  <!--
    isnew(28,"1/31/98")
  <!-->
</SCRIPT>


(person at terminal) HTML index, Free software

(house)  Rick’s home page with index or without index

Last Updated: $Date: 2002/02/03 04:22:48 $ GMT ($Revision: 1.2 $)