/    Sign up×
Community /Pin to ProfileBookmark

Hey friends! I need help i want code for count-down timer just similar to the count-down timer on this site [url]http://www.swoopo.com.I[/url] really need this please reply ASAP i would to thankful to you.Thanks tc

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@vwphillipsNov 02.2008 — [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
// Countdown (04-October-2008)
// by Vic Phillips

// parameter 0 = the unique id of the target element. (string)
// parameter 1 = an arry to specify the start time. (array)
// field 0 = seconds. (digits)
// field 1 = minutes. (digits)
// field 0 = hours. (digits)
// field 0 = days. (digits)
// parameter 2 = (optional) the message to be displayed at the end of the countdown. (string)
// if the message = 'restart' the dountdown will be repeated.

// Notes:
// The count down may be repeated by recalling function zxcCountDown,
// the original parameters 1 and 2 wll be retained unless respecified.

// Functional Code - NO NEED to Change

function zxcCountDown(zxcid,zxcsmhd,zxcmess){
var zxcobj=document.getElementById(zxcid);
var zxcoop=zxcobj.oop
if (!zxcoop) zxcobj.oop=new zxcCountDownOOP(zxcobj,zxcsmhd,zxcmess);
else {
clearTimeout(zxcoop.to);
zxcoop.mess=zxcmess||zxcoop.mess;
zxcoop.smhd=zxcsmhd||zxcoop.smhd;
zxcoop.srt=new Date().getTime();
zxcoop.finend();
zxcoop.cng();
}
}

function zxcCountDownOOP(zxcobj,zxcsmhd,zxcmess){
this.obj=zxcobj;
this.mess=zxcmess||'';
this.smhd=zxcsmhd;
this.srt=new Date().getTime();
this.finend();
this.to=null;
this.cng();
}

zxcCountDownOOP.prototype.cng=function(){
var zxcnow=new Date().getTime();
if (this.end-Math.floor((zxcnow-this.fin)/1000)>0){
var zxcsecs=this.end-Math.floor((zxcnow-this.fin)/1000)-1;
this.obj.innerHTML=(this.smhd[3]?zxcDHMS(zxcsecs,86400,100000)+' days ':'')+(this.smhd[2]||this.smhd[2]?zxcDHMS(zxcsecs,3600,24)+' hours ':'')+(this.smhd[1]||this.smhd[1]||this.smhd[2]?zxcDHMS(zxcsecs,60,24)+' minutes ':'')+zxcDHMS(zxcsecs,1,60)+' seconds';
this.to=setTimeout(function(zxcoop){return function(){zxcoop.cng();}}(this),1000);
}
else {
if (this.mess=='restart') zxcCountDown(this.obj.id);
else if (this.mess) this.obj.innerHTML=this.mess;
}
}
zxcCountDownOOP.prototype.finend=function(){
this.fin=new Date().getTime()+((this.smhd[3]||0)*86400)+((this.smhd[2]||0)*3600)+((this.smhd[1]||0)*60)+((this.smhd[0]||0));
this.end=((this.fin-this.srt));
}

function zxcDHMS(zxcsecs,zxcd,zxcp,zxc0){
zxcsecs=((Math.floor(zxcsecs/zxcd))%zxcp);
return zxcsecs>9?zxcsecs:'0'+zxcsecs;
}

/*]]>*/
</script></head>

<body onload="zxcCountDown('tst',[20,6],'restart'); zxcCountDown('tst1',[20,1,1,1],'message 1');">
<br />
<span id="tst" >1</span>
<br />
<span id="tst1" >2</span>
<input type="button" name="" value="REStart" onclick="zxcCountDown('tst1','message 2',10);"/>

</body>

</html>[/CODE]
Copy linkTweet thisAlerts:
@tariq_wajihaauthorNov 02.2008 — Thank you so much for helping me out.Tc God Bless You
×

Success!

Help @tariq_wajiha 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 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...