jquery - 24 hour Countdown timer using Javascript and PHP -
i need 24 hour countdown timer image in link. need implement timer wordpress site. timer should reset every night @ midnight est.
this current js code restarts each time refresh page. can somehow integrate est?
<script type = "text/javascript"> var timeinsecs; var ticker; function starttimer(secs) { timeinsecs = parseint(secs); ticker = setinterval("tick()", 1000); } function tick( ) { var secs = timeinsecs; if (secs > 0) { timeinsecs--; } else { clearinterval(ticker); starttimer(172800); // start again } var hours= math.floor(secs/3600); secs %= 3600; var mins = math.floor(secs/60); secs %= 60; var pretty = ( (hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs; document.getelementbyid("countdown").innerhtml = pretty; } starttimer(86400); // 24 hours in seconds </script> <span id="countdown" style="font-weight: bold;"></span>
i'll take @ when home, problem every time page loads calling starttimer() method, need current system time (in est format) , convert seconds way when page refreshes have current time , not current defined constant - hope basis find solution.
Comments
Post a Comment