COUNTDOWN
// Source code written by Niek van Suchtelen (niek.van.suchtelen@tip.nl)
// Feel free to use this script in your own page(s), but leave
// my name and email here, and send me an email (mailware!). Also
// leave my name on the page (or if you don't like that, ask me first).
// You can change the date into any date you want, for instance your
// birthday, or your girlfriend's birthday, or the date of your
// wedding, or the date of your friend's death, or the date of
// ehmm...well... whatever. As long as it's not a date above the
// year 2000 (or 2000 itself, that's why i used December 31, 1999
// 23:59:59 for this counter), since JavaScript can't handle them
// (not my fault!). :)
// Make sure to rename this file to countdown.html, instead of
// countdown (the browser needs the .html extension).
var diffYears=-1, diffMonths=-1, diffDays=-1, diffHours=-1, diffMins=-1
// down here put the date you want to count down to (in the exact same way)
// so: "Month Date, Year Hours:Minutes:Seconds" (if you omit
// hours, minutes, or seconds, the value will be set to zero)
var compDat = new Date("December 31, 1999 23:59:59")
var msPerYear = 365 * 24 * 60 * 60 * 1000
var msPerMonth = 31 * 24 * 60 * 60 * 1000
var msPerDay = 24 * 60 * 60 * 1000
var msPerHour = 60 * 60 * 1000
var msPerMin = 60 * 1000
var msPerSec = 1000
function clock(){
var today = new Date()
var changeY = diffYears
var changeM = diffMonths
var changeD = diffDays
var changeH = diffHours
var changeMin = diffMins
var diffMs = compDat.getTime() - today.getTime()
diffYears = Math.floor(diffMs / msPerYear)
diffMs -= diffYears * msPerYear
diffMonths = Math.floor(diffMs / msPerMonth)
diffMs -= diffMonths * msPerMonth
diffDays = Math.floor(diffMs / msPerDay)
diffMs -= diffDays * msPerDay
diffHours = Math.floor(diffMs / msPerHour)
diffMs -= diffHours * msPerHour
diffMins = Math.floor(diffMs / msPerMin)
diffMs -= diffMins * msPerMin
var diffSecs = Math.floor(diffMs / msPerSec)
if(changeY!=diffYears) document.forms[0].years.value=diffYears
if(changeM!=diffMonths) document.forms[0].months.value=diffMonths
if(changeD!=diffDays) document.forms[0].days.value=diffDays
if(changeH!=diffHours) document.forms[0].hours.value=diffHours
if(changeMin!=diffMins) document.forms[0].mins.value=diffMins
document.forms[0].secs.value=diffSecs
timerID = setTimeout("clock()",1000)
}
years
months
days
hours
minutes
seconds
LEFT UNTIL THE YEAR 2000!!!!
Counter written by Niek van Suchtelen -
niek.van.suchtelen@tip.nl
Wyszukiwarka
Podobne podstrony:
McGraw Hill, Countdown to Spanish Learn to Communicate in 24 Hours (2004) LiB04 10 Styczeń 2000 To nie koniec84 27 Grudzień 2000 To nie jest zdrada62 6 Czerwiec 2000 Nie czołgiem, to atomem2000 12 Linux to Go to School48 5 Kwiecień 2000 Kto to pani odmalowałCognitive Psychology from Hergenhahn Introduction to the History of Psychology, 2000To dzięki wam PreludiumThe Best Way to Get Your Man to Commit to Youczytaj to terazczytaj to42 30 Marzec 2000 Dialog na warunkachCSharp Introduction to C# Programming for the Microsoft NET Platform (Prerelease)E Book Art Anime How To Draw Iria2 minutes to midnightwięcej podobnych podstron