1 2 3 4 5 6 7 8 9 10 11 12 13
| <script>
var heureCourante = new Date();
heureCourante.setHours(24-heureCourante.getHours());
heureCourante.setMinutes(60-heureCourante.getMinutes());
heureCourante.setSeconds(60-heureCourante.getSeconds());
function AffichageCompteARebours() {
heureCourante.setSeconds(heureCourante.getSeconds()-1);
document.getElementById("CompteARebours").innerHTML = heureCourante.getHours() + " heures " + heureCourante.getMinutes() + " minutes " + heureCourante.getSeconds() + " secondes ";
}
window.onload = function () { setInterval(AffichageCompteARebours,1000); }
</script> |
....
Dans la page.. pour afficher le compte à rebours :
<div id=CompteARebours></div>
L'heure "butoir" est ici minuit. Tu peux essayer de modifier le script à ta convenance.
Partager