From 6b2b064f5733d6019ee3cd93a922fd3c19368026 Mon Sep 17 00:00:00 2001 From: Thibaut Renaut Date: Fri, 16 Feb 2024 16:44:32 +0100 Subject: [PATCH 1/2] =?UTF-8?q?Commit=20de=20mon=20contr=C3=B4le,=20image?= =?UTF-8?q?=20non=20apparente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 91 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/index.html b/index.html index be6da78..0d8f8f8 100644 --- a/index.html +++ b/index.html @@ -1,57 +1,76 @@ + Page Title - + + - - + + -
- -
+
+ +
+
-
- + + + - + - - + + - - + + + + + \ No newline at end of file -- GitLab From 5fdc5e4a1cf35bd5892cacf64f64654fb029b9bf Mon Sep 17 00:00:00 2001 From: Thibaut Renaut Date: Fri, 16 Feb 2024 16:48:40 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Commit=20de=20mon=20contr=C3=B4le,=20image?= =?UTF-8?q?=20non=20apparente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/car.js | 31 +++++++++++++++++++++++++++++++ js/extra.js | 4 ++++ 2 files changed, 35 insertions(+) create mode 100644 js/car.js create mode 100644 js/extra.js diff --git a/js/car.js b/js/car.js new file mode 100644 index 0000000..95debb9 --- /dev/null +++ b/js/car.js @@ -0,0 +1,31 @@ +function Car(image, make, model, description, price, category, year, mileage, extras) { + this.image = image; + this.make = make; + this.model = model; + this.description = description; + this.price = price; + this.category = category; + this.year = year; + this.mileage = mileage; + this.extras = extras; +} + +//je ne comprend pas pourquoi les images ne s'affiche pas +Car.prototype.generateImage = function (elt) { + crossOriginIsolated.log(this.image); + let img = document.createElement("img"); + img.setAttribute("src", this.image); + img.setAttribute("alt", this.make + " " + this.model); + img.setAttribute("class", "card-img-top"); + elt.appendChild(img); +} + +Car.prototype.generateExtras = function (elt){ + let ul = document.createElement("ul"); + for (let extra of this.extras) { + let li = document.createElement("li"); + li.textContent = extra.name + ' - €' + extra.price; + ul.appendChild(li); + } + elt.appendChild(ul); +} \ No newline at end of file diff --git a/js/extra.js b/js/extra.js new file mode 100644 index 0000000..d5f7ff9 --- /dev/null +++ b/js/extra.js @@ -0,0 +1,4 @@ +function Extra(name, price) { + this.name = name; + this.price = price; +} \ No newline at end of file -- GitLab