Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

Set time limit on New links


< html >
< head >
< script >
<!-- Original :  Nicolas -->
<!-- Web Site :  http : //www.javascript-page.com -->

function checknew(date) {
var pic = "c0.gif" ;
expdate = new Date (date);
curdate = new Date ();
if (expdate.getTime() > curdate.getTime())
document.write( "<img src=" + pic + ">" );
}
</ script >

</ head >

< body Background = .. / graphics / grayback.jpg >
< center >< BR >< BR >< BR >
< script > checknew( "6/01/2000" ) </ script > Shown as "New" until 6 / 01 / 2000 < br >
< script > checknew( "12/01/2000" ) </ script > Shown as "New" until 12 / 01 / 2000 < br >

< script > checknew( "6/01/2001" ) </ script > Shown as "New" until 6 / 01 / 2001 < br >
< script > checknew( "12/01/2001" ) </ script > Shown as "New" until 12 / 01 / 2001 < br >

<!-- Each news item should have an expiration check
      with this : < script > checknew( "6/01/2000" ) </ script > -->

<!-- Also remember to save the new .gif image to your server.
    Right click the link below and select "Save Image As..."

    c0.gif   -->

</ center >
</ BODY >
</ html >

//Thanks to David Pye for his JavaScript Vault contribution.