|
When you add something to your site or modify something,
you usually place a
Using JavaScript, it is possible to program your HTML to display the new icon only for a certain period of time. You write a JavaScript function which compares the current date with the expiry date and inserts the new icon only if the current date has not exceded the expiry date. Here is the code : <SCRIPT LANGUAGE="JavaScript"> <!-- Hide code from non-js browsers function newItem(expiryDate) { exp = new Date(expiryDate); cur = new Date(); if (cur.getTime() < exp.getTime()) document.write("<IMG SRC=\"new.gif\" WIDTH=31 HEIGHT=12 BORDER=0>" ALT=\"new\"); } // end hiding --> </SCRIPT>Usually, functions like this are defined between the <HEAD> and </HEAD> |