var futuredate
var nowdate
var resulthoursraw
var resulthours
var resultminutesraw
var resultminutes
var resultsecondsraw
var resultseconds
var content
function setfuturedate() {
var futureyear=document.future.ye.options[document.future.ye.selectedIndex].value
var futuremonth=document.future.mo.options[document.future.mo.selectedIndex].value
var futureday=document.future.da.options[document.future.da.selectedIndex].value
futuredate=new Date(futureyear,futuremonth,futureday,0,0,0)
docountdown()
}
function docountdown() {
caclulateresults()
formatresults()
displayresults()
setTimeout("docountdown()",1000)
}
function caclulateresults() {
nowdate=new Date()
resultdaysraw=(Date.parse(futuredate)-Date.parse(nowdate))/1000/60/60/24
resultdays=Math.floor((Date.parse(futuredate)-Date.parse(nowdate))/1000/60/60/24)
resulthoursraw=(resultdaysraw-resultdays)*24
resulthours=Math.floor((resultdaysraw-resultdays)*24)
resultminutesraw=(resulthoursraw-resulthours)*60
resultminutes=Math.floor((resulthoursraw-resulthours)*60)
resultsecondsraw=(resultminutesraw-resultminutes)*60
resultseconds=Math.floor((resultminutesraw-resultminutes)*60)
}
function formatresults() {
content="Még "+resultdays+" nap "+resulthours+" óra "+resultminutes +" perc "+resultseconds +" másodperc van hátra a kijelőlt időszakig."
}
function displayresults() {
if (document.all) {
document.future.erd.value=content
}
if (document.layers) {
document.future.erd.value=content
}
}
|