ASP Programming | ASP Web Pro
  Active Server Pages Programming by ASP Web Pro

JavaScripts

COUNT DOWN TO DATE

This script performs a count down to any any date you plug in. You can customize as many different messages as you like. Here is how the script will display like this:

<HTML><HEAD>
<TITLE>ASP Web Pro</TITLE>
</HEAD>

<BODY>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var date = new Date("January 1, 2010");
var description = "New Years Day 2010!";
var now = new Date();
var diff = date.getTime() - now.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
document.write("<center><h3>")
if (days > 1) {
document.write(days+1 + " days until " + description);
}
else if (days == 1) {
document.write("2 days left until " + description);
}
else if (days == 0) {
document.write("Tomorrow is " + description);
}
else {
document.write("Today is" + description + "!");
}
document.write("</h3></center>");
// End -->
</SCRIPT>

</BODY>
</HTML>

< Back to JavaScripts


 

 

Main Menu
Home
ASP Scripts
ASP Tutorials
JavaScripts
Awards
Contact Us

Email This Page

Other Resources
ASP Web Hosting
Search Engine Submission
Programming Help

 

 

 

Other ASP Web Sites

Site Map

 

Last Updated:
13 May 2008