function CountdownTimer(elm,tl,mes){
this.initialize.apply(this,arguments);
}
CountdownTimer.prototype={
initialize:function(elm,tl,mes) {
this.elem = document.getElementById(elm);
this.tl = tl;
this.mes = mes;
},countDown:function(){
var timer='';
//var today=new Date();
var today=new Date();
var sec=Math.floor(((this.tl-today)%(24*60*60*1000))/1000)%60%60;
var me=this;
if( ( this.tl - today ) > 0 ){
// timer += 'DAYS
'+day+'';
// timer += 'HOURS
'+hour+'';
// MINS
'+this.addZero(min)+'
timer += ''+this.addZero(sec)+'';
this.elem.innerHTML = timer;
tid = setTimeout( function(){me.countDown();},10 );
}else{
this.elem.innerHTML = this.mes;
return;
}
},addZero:function(num){ return ('0'+num).slice(-2); }
}
function CDT(){
// Set countdown limit
var tl = new Date(Date.now()+20000);
//var tl = new Date('2020/01/01 00:00:00');
// You can add time's up message here
var timer = new CountdownTimer('CDT',tl,'Стартуем!');
timer.countDown();
}
window.onload=function(){
CDT();
}