From 13eb421ce3daf8e1f27b378ffc456c4f8b4ef384 Mon Sep 17 00:00:00 2001 From: Kyllian LE BRETON Date: Fri, 16 Feb 2024 14:50:55 +0100 Subject: [PATCH 1/3] Commit Rendu --- index.html | 98 ++++++++++++++++++++++++++++++----------------------- js/car.js | 37 ++++++++++++++++++++ js/extra.js | 4 +++ 3 files changed, 97 insertions(+), 42 deletions(-) create mode 100644 js/car.js create mode 100644 js/extra.js diff --git a/index.html b/index.html index be6da78..32d5d8f 100644 --- a/index.html +++ b/index.html @@ -1,57 +1,71 @@ - - Page Title - - - - - - + + Page Title + + + + + + -
- -
+
+ +
+
-
- + + + + - - + + - - + + - + \ No newline at end of file diff --git a/js/car.js b/js/car.js new file mode 100644 index 0000000..0772af6 --- /dev/null +++ b/js/car.js @@ -0,0 +1,37 @@ +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; +} + +Car.prototype.generateImage = function(elt) { + var img = document.createElement('img'); + + img.src = this.image; + img.alt = this.make + ' ' + this.model; + img.classList.add('card-img-top'); + + elt.appendChild(img); +} + +Car.prototype.generateExtras = function(elt) { + var ul = document.createElement('ul'); + + this.extras.forEach(function(extra) { + var li = document.createElement('li'); + li.textContent = extra.name + ' ' + extra.price; + ul.appendChild(li); + }); + + elt.appendChild(ul); +} + + + diff --git a/js/extra.js b/js/extra.js new file mode 100644 index 0000000..811daa5 --- /dev/null +++ b/js/extra.js @@ -0,0 +1,4 @@ +function Extra(name, price) { + this.name = name; + this.price = price; +} -- GitLab From e51632fa0303a39404c868a69ca24885398a6630 Mon Sep 17 00:00:00 2001 From: Kyllian LE BRETON Date: Fri, 16 Feb 2024 14:53:05 +0100 Subject: [PATCH 2/3] Commit rendu --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 32d5d8f..2531a40 100644 --- a/index.html +++ b/index.html @@ -32,14 +32,14 @@
+ +