diff --git a/equipe.js b/equipe.js index 4214961..fd957fa 100644 --- a/equipe.js +++ b/equipe.js @@ -55,3 +55,34 @@ document.getElementById("trier").addEventListener("click", function () { }); afficherEquipe(triee); }); + +const flotte1 = [ + { modele: "Renault Kangoo", immatriculation: "AB-123-CD", km: 45200 }, + { modele: "Peugeot Partner", immatriculation: "EF-456-GH", km: 78900 }, + { modele: "Citroën Berlingo", immatriculation: "IJ-789-KL", km: 12300 }, +]; + +function createLign(car) { + const tr = document.createElement("tr"); + + const tdmodele = document.createElement("td"); + tdmodele.textContent = car.modele; + + const tdimma = document.createElement("td"); + tdimma.textContent = car.immatriculation; + + const tdkm = document.createElement("td"); + tdkm.textContent = car.km; + + tr.append(tdmodele, tdimma, tdkm); + return tr; +} +const flotte = document.getElementById("flotte_tableau"); + +function afficherFlotte(list) { + flotte.innerHTML = ""; + for (const car of list) { + flotte.append(createLign(car)); + } +} +afficherFlotte(flotte1); diff --git a/flotte.js b/flotte.js index 2649ced..4f27757 100644 --- a/flotte.js +++ b/flotte.js @@ -1,5 +1,5 @@ async function chargerFlotte() { - const reponse = await fetch("./vehicules.json"); // on demande le fichier + const reponse = await fetch("../vehicules.json"); // on demande le fichier const vehicules = await reponse.json(); // on le transforme en tableau JS console.log(vehicules); // pour vérifier } diff --git a/pages/contact.html b/pages/contact.html index be02124..26145e0 100644 --- a/pages/contact.html +++ b/pages/contact.html @@ -67,12 +67,25 @@ + + + + + + + + + + +
ModèleimmatriculationKm
+ - +