Back to Scripts page
Click in the box below, select all and copy to grab the script
<HTML> <HEAD> <TITLE>Dynamic Countdown</TITLE> <SCRIPT LANGUAGE=JAVASCRIPT> <!-- Hide script from old browsers // This script copyright 1997, Tom Negrino and Dori Smith. // This script is from "JavaScript for the WWW, Visual QuickStart Guide, 2nd Ed." // For more information, see <http://www.chalcedony.com/javascript/>. // This script may be used and modified, but the copyright notice must remain intact. now = new Date anniv = new Date (now.getYear(),6,21) if (anniv.getTime() < now.getTime()) { anniv.setYear(anniv.getYear()+1) } birthday = new Date (now.getYear(),7,7) if (birthday.getTime() < now.getTime()) { birthday.setYear(birthday.getYear()+1) } xmas = new Date (now.getYear(),11,25) if (xmas.getTime() < now.getTime()) { xmas.setYear(xmas.getYear()+1) } 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:<BR><BR> <SCRIPT LANGUAGE=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>