Back to Scripts page
Click in the text area below, select all and copy to grab the script
Script listing:
<HTML> <HEAD> <TITLE>Dynamic Countdown</TITLE> <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> <!-- Hide script from old browsers now = new Date thisYr = now.getYear() if (thisYr < 1900) { thisYr = thisYr+1900 } nextYr = thisYr + 1 anniv = new Date(thisYr,6,21) if (anniv.getTime() < now.getTime()) { anniv.setYear(nextYr) } birthday = new Date(thisYr,7,7) if (birthday.getTime() < now.getTime()) { birthday.setYear(nextYr) } xmas = new Date(thisYr,11,25) if (xmas.getTime() < now.getTime()) { xmas.setYear(nextYr) } function dayToDays(inTime) { return (Math.floor(inTime.getTime() / (1000 * 60 * 60 * 24))) } function daysTill(inDate) { return dayToDays(inDate) - dayToDays(now) } // End hiding script from old browsers --> </SCRIPT> </HEAD> <BODY BGCOLOR=WHITE> <H1>Dori says:<P> <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"> <!-- Hide script from old browsers document.write("It's only " + daysTill(birthday) + " days until my birthday and " + daysTill(xmas) + " days until Christmas--you'd better start shopping now!") document.write("<p>And it's only "+ daysTill(anniv) +" days until our anniversary...") // End hiding script from old browsers --> </SCRIPT> </H1> </BODY> </HTML>