Marking New Entries
Join the Discussion
You have probably seen web pages where the latest additions are indicated by a "new" image next to them (example: ). It is easy enough to add the image next to the new entries as you add them but you also need to remember to go back and remove the image once an appropriate amount of time has passed so that older entries are no longer marked as new.
If you use this script to put the image next to each entry then it will disappear automatically after a set number of days allowing you to set and forget.
The first thing to do is to get the following script and save is as new.js.
You will need to update the four lines at the top of the script to specify the number of days that the "new" image is to display for (example: 7 days), the name of the image file (example: graphics/new.gif), the width of the image (example: 31), and the height of the image (example: 12). Once you have this script set up you will not need to change it.
The next step is to add it to the head section of your web page using the following code:
Place the following code in front of each of your new entries where you want the "new" image to appear changing the parameters to the current year, month, and day. The new image will then be displayed in the spot where this code is placed for the number of days specified in the above script. You will need to do this each time you add a new entry onto your page.
If you don't have your own "new" image to use then you may take a copy of mine that appears above.