Commentaires de Nitwix

Score : 5905 / 9128 commentaires
Nitwix
Voilà ^^ :

<!DOCTYPE html>
<html>
<head>
<title>Compte à rebours</title>
<script type="text/javascript">
function $(id){
return document.getElementById(id);
}
var inter;
function launch(){
var dVac = new Date($("dVac").value);
var now = new Date();
var diff = Math.floor((dVac - now)/(1000)) - 7200; /*7200 pour le fuseau horaire (2 heures) */
clearInterval(inter);
inter = setInterval(function(){
$("aff").innerHTML = diff;
diff--;
if(diff <= 0) clearInterval(inter);
},1000);
}
</script>
</head>
<body>
<label>Date des vacances </label><input type="datetime-local" id="dVac">
<button onclick="launch();">Lancer</button>
<h1 id="aff"></h1>
</body>
</html>