server/htdocs/js/countdown.js
2013-11-25 15:35:56 +01:00

21 lines
471 B
JavaScript

function update_end()
{
var left = (end_challenge - new Date())/1000;
if (left < 0) left = 0;
var heure = Math.floor(left / 3600);
var min = Math.floor((left / 60) % 60);
var sec = Math.floor(left % 60);
$("#hours").html(( heure < 10 ? "0" : "" ) + heure);
$("#min").html(( min < 10 ? "0" : "" ) + min);
$("#sec").html(( sec < 10 ? "0" : "" ) + sec);
}
$(document).ready(function() {
setInterval( function() {
update_end();
}, 1000);
});