added tableau flotte and other stuff in flotte.js

This commit is contained in:
2026-06-22 16:50:28 +02:00
parent 608cceec18
commit e0589bf965
3 changed files with 53 additions and 37 deletions
-31
View File
@@ -55,34 +55,3 @@ 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);