/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] countdown timer

I wonder if someone knows where i can get a countdown script for 24hours, or how one can be made? with active javascript

basiclly what i need is, when 24hours of the set time has run, it resets to 0 and begins to count down from 24hours again… like if i put it on 09:00PM it should start counting down from there and reset when it reach 09:00Pm again the next day and start over…

hope someone can help me.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@evaniaauthorDec 13.2007 — noone knows? :/
Copy linkTweet thisAlerts:
@KorDec 13.2007 — and the result will be display as? HH:MM:SS ? Or what? Only seconds, only minutes?...
Copy linkTweet thisAlerts:
@evaniaauthorDec 13.2007 — as HH:MM:SS ye
Copy linkTweet thisAlerts:
@KorDec 13.2007 — <i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;
&lt;meta http-equiv="Content-Script-Type" content="text/javascript"&gt;
&lt;script type="text/javascript"&gt;
function countDown(){
var nextH=[21,0,0]; //countDown stop [hours,minutes,seconds]
var stopT=new Date();
stopT.setHours(nextH[0]);
var startT=new Date();
var plusH=(stopT&gt;startT)?0:24;//add or not 24 hours
stopT=new Date();
stopT.setHours(nextH[0]+plusH);
stopT.setMinutes(nextH[1]);
stopT.setSeconds(nextH[2]);
var dif=stopT-startT;
displayCD(dif);
}
function displayCD(dif){
var myS=document.getElementById('myspan');
var d=Math.floor(dif/1000);
var m=Math.floor(d/60);var S=d%60;
var H=Math.floor(m/60);var M=m%60;
if(S&lt;0){S=59;M--}
if(M&lt;0){M=59;H--}
H&lt;10?H='0'+H:null;M&lt;10?M='0'+M:null;S&lt;10?S='0'+S:null;
myS.innerHTML=H+':'+M+':'+S;
dif-=1000;
setTimeout(function(){displayCD(dif)},1000);
}
onload=function(){
countDown();
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;span id="myspan"&gt;&lt;/span&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@evaniaauthorDec 13.2007 — <i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;
&lt;meta http-equiv="Content-Script-Type" content="text/javascript"&gt;
&lt;script type="text/javascript"&gt;
function countDown(){
var nextH=[21,0,0]; //countDown stop [hours,minutes,seconds]
var stopT=new Date();
stopT.setHours(nextH[0]);
var startT=new Date();
var plusH=(stopT&gt;startT)?0:24;//add or not 24 hours
stopT=new Date();
stopT.setHours(nextH[0]+plusH);
stopT.setMinutes(nextH[1]);
stopT.setSeconds(nextH[2]);
var dif=stopT-startT;
displayCD(dif);
}
function displayCD(dif){
var myS=document.getElementById('myspan');
var d=Math.floor(dif/1000);
var m=Math.floor(d/60);var S=d%60;
var H=Math.floor(m/60);var M=m%60;
if(S&lt;0){S=59;M--}
if(M&lt;0){M=59;H--}
H&lt;10?H='0'+H:null;M&lt;10?M='0'+M:null;S&lt;10?S='0'+S:null;
myS.innerHTML=H+':'+M+':'+S;
dif-=1000;
setTimeout(function(){displayCD(dif)},1000);
}
onload=function(){
countDown();
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;span id="myspan"&gt;&lt;/span&gt;
&lt;/body&gt;
&lt;/html&gt;
[/QUOTE]



absoloutly perfect! thank you so much!
×

Success!

Help @evania spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 7.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: @Nanditha,
tipped: article
amount: 1000 SATS,
)...