-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct_details.html
39 lines (37 loc) · 1.47 KB
/
product_details.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Details</title>
<!-- Add your styles if needed -->
</head>
<body>
<div>
<h1 id="productName"></h1>
<div id="productDetails">
<img id="productImage" alt="Product Image">
<div>
<p id="productDescription"></p>
<p id="productPrice"></p>
</div>
</div>
</div>
<script>
// Use JavaScript to populate the details based on the selected product
document.addEventListener("DOMContentLoaded", function() {
// Retrieve data from the URL or any other source
const urlParams = new URLSearchParams(window.location.search);
const productName = urlParams.get('name');
const productDescription = urlParams.get('description');
const productPrice = urlParams.get('price');
const productImage = urlParams.get('image');
// Populate the HTML elements
document.getElementById('productName').innerText = productName;
document.getElementById('productDescription').innerText = productDescription;
document.getElementById('productPrice').innerText = `Price: ${productPrice}`;
document.getElementById('productImage').src = productImage;
});
</script>
</body>
</html>