Tengo este código que es un coutdown y no sé como ponerle un if que muestre el countdown, pero en caso de que se supere la fecha limitada muestre un mensaje...
Código:
<script type="text/javascript">'; echo ' function DaysHMSCounter(initDate, id){ this.counterDate = new Date(initDate); this.container = document.getElementById(id); this.update(); } DaysHMSCounter.prototype.calculateUnit=function(secDiff, unitSeconds){ var tmp = Math.abs((tmp = secDiff/unitSeconds)) < 1? 0 : tmp; return Math.abs(tmp < 0 ? Math.ceil(tmp) : Math.floor(tmp)); } DaysHMSCounter.prototype.calculate=function(){ var secDiff = Math.abs(Math.round(((new Date()) - this.counterDate)/1000)); this.days = this.calculateUnit(secDiff,86400); this.hours = this.calculateUnit((secDiff-(this.days*86400)),3600); this.mins = this.calculateUnit((secDiff-(this.days*86400)-(this.hours*3600)),60); this.secs = this.calculateUnit((secDiff-(this.days*86400)-(this.hours*3600)-(this.mins*60)),1); } DaysHMSCounter.prototype.update=function(){ this.calculate(); this.container.innerHTML = "<strong>" + this.days + "</strong> " + (this.days == 1? "Día" : "Días") + " <strong>" + this.hours + "</strong> " + (this.hours == 1? "Hora" : "Horas") + " <strong>" + this.mins + "</strong> " + (this.mins == 1? "Minuto" : "Minutos") + " <strong>" + this.secs + "</strong> " + (this.secs == 1? "Segundo" : "Segundos"); var self = this; setTimeout(function(){self.update();}, (1000)); } window.onload=function(){ new DaysHMSCounter("' . $mes_ingles . ' ' . $baneo['dia_desbaneo'] . ', ' . $baneo['ano_desbaneo'] . ' ' . $baneo['hora_desbaneo'] . ':' . $baneo['minutos_desbaneo'] . ':' . $baneo['segundos_desbaneo'] . '", "counter"); }'; echo ' </script>';