added time to fotbar and badge now auto refresh
This commit is contained in:
+22
-7
@@ -4,17 +4,22 @@ const motCaractere = document.getElementById("mot");
|
||||
const boutonEffacer = document.getElementById("effacer");
|
||||
const formulaire = document.querySelector("form");
|
||||
const badge = document.getElementById("statut_horaires");
|
||||
|
||||
const nom = document.getElementById("prenom");
|
||||
const heure = new Date().getHours();
|
||||
const MAX = 500;
|
||||
|
||||
if (heure >= 9 && heure < 18) {
|
||||
badge.textContent = "✅ Nous sommes ouverts (9h–18h)";
|
||||
badge.style.color = "green";
|
||||
} else {
|
||||
badge.textContent = "🔴 Fermé — écrivez-nous, on répond dès l'ouverture !";
|
||||
badge.style.color = "red";
|
||||
function rafraichir_badge() {
|
||||
const heure = new Date().getHours();
|
||||
|
||||
if (heure >= 9 && heure < 18) {
|
||||
badge.textContent = "✅ Nous sommes ouverts (9h–18h)";
|
||||
badge.style.color = "green";
|
||||
} else {
|
||||
badge.textContent = "🔴 Fermé — écrivez-nous, on répond dès l'ouverture !";
|
||||
badge.style.color = "red";
|
||||
}
|
||||
}
|
||||
setInterval(rafraichir_badge, 60);
|
||||
|
||||
function rafraichirCompteur() {
|
||||
const restant = MAX - zoneMessage.value.length;
|
||||
@@ -67,3 +72,13 @@ titres.forEach(function (titre) {
|
||||
reponse.classList.toggle("ouverte");
|
||||
});
|
||||
});
|
||||
|
||||
const horloge = document.getElementById("horloge");
|
||||
|
||||
function afficherHeure() {
|
||||
const maintenant = new Date();
|
||||
horloge.textContent = maintenant.toLocaleTimeString();
|
||||
}
|
||||
|
||||
afficherHeure();
|
||||
setInterval(afficherHeure, 1000);
|
||||
|
||||
@@ -187,3 +187,7 @@ body.sombre {
|
||||
justify-content: center;
|
||||
padding-top: 30 px;
|
||||
}
|
||||
|
||||
#horloge {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
+2
-1
@@ -75,8 +75,9 @@
|
||||
</table>
|
||||
|
||||
<footer class="footer">
|
||||
stagiaires rpz echoes
|
||||
<button type="button" id="theme"> Mode sombre</button>
|
||||
<b>stagiaires rpz echoes</b>
|
||||
<span id="horloge"></span>
|
||||
</footer>
|
||||
<script src="../equipe.js"></script>
|
||||
<script src="../contact.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user