This simple script will display a "New!" image beside new content for a certain period of time, then disappear automatically when the time expires. Just set a date, and the image will be displayed up to and including that date, then it will automatically be removed. For the purposes of this demonstration I've set the expiry date to 31 December 2001, but you could set it for seven days hence, a month, or whenever you wish.
First, add the following script to the <HEAD> section:
| <script language="JavaScript" type="text/javascript"> <!-- //set the image you wish to use as the "new" image var imgtag='<img src="new.gif" width=56 height=35 border=0 alt="New!">' var today=new Date() function expireon(expiredate){ var expire=new Date(expiredate) if (today.getTime()<=expire.getTime()) document.write(imgtag) } //--> </script> |
Then insert this script where you want the image to appear, changing the date to your requirements:
| <script language="JavaScript" type="text/javascript"> <!-- expireon("December 31, 2001") // --> </script> |