début json lol
This commit is contained in:
+25
-3
@@ -69,7 +69,7 @@ zoneMsg.addEventListener("input", function () {
|
||||
formulaire.addEventListener("submit", function (evenement) {
|
||||
if (zoneMsg.value.trim() === "") {
|
||||
evenement.preventDefault();
|
||||
alert("Merci de remplir tous les champs");
|
||||
alert("Merci d'écrire un message");
|
||||
}
|
||||
});
|
||||
for (const service of services) {
|
||||
@@ -92,5 +92,27 @@ document.getElementById("color").addEventListener("click", function () {
|
||||
function heure() {
|
||||
horloge.textContent = new Date().toLocaleTimeString();
|
||||
}
|
||||
heure();
|
||||
setInterval(heure, 1000);
|
||||
{
|
||||
heure();
|
||||
setInterval(heure, 1000);
|
||||
}
|
||||
{
|
||||
async function Flotte() {
|
||||
const message = document.getElementById("message_flotte");
|
||||
const corps = document.getElementById("corps_flotte");
|
||||
try {
|
||||
const reponse = await fetch("vehicules.json");
|
||||
const vehicules = await reponse.json();
|
||||
for (const v of vehicules) {
|
||||
const tr = document.createElement("tr");
|
||||
tr.textContent = `${v.modele} — ${v.immatriculation} — ${v.km} km`;
|
||||
corps.append(tr);
|
||||
}
|
||||
} catch (erreur) {
|
||||
message.textContent =
|
||||
"Impossible de charger la flotte (bahahaha mimimimimi)";
|
||||
console.error(erreur);
|
||||
}
|
||||
}
|
||||
Flotte();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"modele": "Renault Kangoo",
|
||||
"immatriculation": "AB-123-CD",
|
||||
"km": 6767676767
|
||||
},
|
||||
{ "modele": "Peugeot Partner", "immatriculation": "EF-456-GH", "km": 6767 }
|
||||
]
|
||||
@@ -71,6 +71,7 @@
|
||||
stagiaires rpz echoes
|
||||
<span id="horloge"></span>
|
||||
</footer>
|
||||
<p id="message_flotte"></p>
|
||||
<script src="css/devis.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user