From c222495f56fe0e29392eb4b50d9421b4cc047619 Mon Sep 17 00:00:00 2001 From: Safaa Mahdir <safaa.mahdir@imt-atlantique.net> Date: Wed, 26 Mar 2025 15:22:07 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20affichage=20d'une=20liste=20statique=20?= =?UTF-8?q?de=205=20Pok=C3=A9mon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 14 ++++++++++++++ script.js | 21 +++++++++++++++++++++ styles.css | 18 ++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 index.html create mode 100644 script.js create mode 100644 styles.css diff --git a/index.html b/index.html new file mode 100644 index 0000000..078d401 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="fr"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Pokémon Filter</title> + <link rel="stylesheet" href="styles.css"> +</head> +<body> + <h1>Liste de Pokémon</h1> + <ul id="pokemon-list"></ul> + <script src="script.js"></script> +</body> +</html> \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..7c602e9 --- /dev/null +++ b/script.js @@ -0,0 +1,21 @@ +const pokemons = [ + { name: "Beedrill", weight: 29.5, height: 1 }, + { name: "Blastoise", weight: 85.5, height: 1.6 }, + { name: "Bulbasaur", weight: 6.9, height: 0.7 }, + { name: "Butterfree", weight: 32, height: 1.1 }, + { name: "Caterpie", weight: 2.9, height: 0.3 } +]; + +function displayPokemonList() { + const listElement = document.getElementById("pokemon-list"); + listElement.innerHTML = ""; + + pokemons.forEach(pokemon => { + const listItem = document.createElement("li"); + listItem.textContent = `${pokemon.name} - Poids: ${pokemon.weight} kg - Taille: ${pokemon.height} m`; + listElement.appendChild(listItem); + }); +} + +// Afficher la liste au chargement de la page +document.addEventListener("DOMContentLoaded", displayPokemonList); diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..bcd5606 --- /dev/null +++ b/styles.css @@ -0,0 +1,18 @@ +body { + font-family: Georgia, sans-serif; +} + +h1 { + color: darkcyan; +} + +ul { + list-style-type: none; + padding: 0; +} + +li { + margin: 10px; + padding: 10px; + border-radius: 5px; +} \ No newline at end of file -- GitLab