-
Notifications
You must be signed in to change notification settings - Fork 8
/
product.html
179 lines (146 loc) · 8.93 KB
/
product.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Store</title>
<script src="./include/prodbs.js"></script>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="src/SimpleStarRating.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" />
</head>
<body>
<div class="container">
<div class="header"><a href="#"><img src="./logo2.jpg" alt="not found" name="Insert_logo" width="20%" height="90" id="Insert_logo" style="background-color: #8090AB; display:block;" /></a>
</div>
<div class="button">
<button id="btn001" type="button">Sign Up!</button>
<button id="btn002" type="button" class="fas fa-shopping-cart fa-2x"></button>
</div>
<div class="content">
<h1>Your Shop</h1><br/>
<h2>Products</h2>
</div>
<!-------- products --------------->
<section class="products">
<div class="pcard">
<img src="./img/toy1.jpg" class="primg0" alt="unavailable" >
<div class="product-info">
<h1><script>document.write(prodb[0].pname);</script></h1>
<p class="price" id="price0"><script>document.write(prodb[0].price);</script>$</p>
<p>Product Description</p>
<!-----start rating----->
<span class="rating" data-default-rating="4.5"></span>
<!-----end rating----->
</div>
<p> <form class = "pform">
<label for="quantity">Enter Quantity:</label><br/>
<input type="number" id="quantity0" name="quantity" min="1" max="5" onchange = "instantPrice0()">
<script>
function instantPrice0 () {
var quantvar0 = document.getElementById("quantity0");
var quantmp0 = quantvar0.value;
var newPrice0 = quantmp0 * (prodb[0].price);
var priceout0 = document.getElementById ("price0");
priceout0.innerHTML = newPrice0 + "$";
}
</script>
<input class="pbutton" type="submit" value="Add to Cart">
</form></p> <br/> <br/>
</div>
<hr>
<div class="pcard">
<img src="./img/toy2.jpg" class="primg0" alt="unavailable" >
<div class="product-info">
<h1>Teddy Bear</h1>
<p class="price" id = "price1"><script>document.write(prodb[1].price);</script>$</p>
<p>Product Description</p>
<!-----start rating----->
<span class="rating" data-default-rating="3.5"></span>
<!-----end rating----->
</div>
<p> <form class = "pform">
<label for="quantity">Enter Quantity:</label><br/>
<input type="number" id="quantity1" name="quantity" min="1" max="5" onchange = "instantPrice1()">
<script>
function instantPrice1() {
var quantvar1 = document.getElementById("quantity1");
var quantmp1 = quantvar1.value;
var newPrice1 = quantmp1 * (prodb[1].price);
var priceout1 = document.getElementById ("price1");
priceout1.innerHTML = newPrice1 + "$";
}
</script>
<input class="pbutton" type="submit" value="Add to Cart">
</form></p>
</div>
<hr>
<div class="pcard">
<img src="./img/gun1.jpg" class="primg0" alt="unavailable" >
<div class="product-info">
<h1>Toy Gun</h1>
<p class="price" id = "price2"><script>document.write(prodb[2].price);</script>$</p>
<p>Product Description</p>
<!-----start rating----->
<span class="rating" data-default-rating="4"></span>
<!-----end rating----->
</div>
<p> <form class = "pform">
<label for="quantity">Enter Quantity:</label><br/>
<input type="number" id="quantity2" name="quantity" min="1" max="5"onchange = "instantPrice2()">
<script>
function instantPrice2() {
var quantvar2 = document.getElementById("quantity2");
var quantmp2 = quantvar2.value;
var newPrice2 = quantmp2 * (prodb[2].price);
var priceout2 = document.getElementById ("price2");
priceout2.innerHTML = newPrice2 + "$";
}
</script>
<input class="pbutton" type="submit" value="Add to Cart">
</form></p>
</div>
<hr>
<div class="pcard">
<img src="./img/toy3.jpg" class="primg0" alt="unavailable" >
<div class="product-info">
<h1>Circles</h1></h1>
<p class="price" id = "price3"><script>document.write(prodb[3].price);</script>$</p>
<p>Product Description</p>
<!-----start rating----->
<span class="rating" data-default-rating="2"></span>
<!-----end rating----->
</div>
<p> <form class = "pform">
<label for="quantity">Enter Quantity:</label><br/>
<input type="number" id="quantity3" name="quantity" min="1" max="5" onchange = "instantPrice3()">
<script>
function instantPrice3() {
var quantvar3 = document.getElementById("quantity3");
var quantmp3 = quantvar3.value;
var newPrice3 = quantmp3 * (prodb[3].price);
var priceout3 = document.getElementById ("price3");
priceout3.innerHTML = newPrice3 + "$";
}
</script>
<input class="pbutton" type="submit" value="Add to Cart">
</form></p>
</div>
<hr>
</section>
<br>
<!------- End Products-------->
<div class="footer">
<script src="./src/SimpleStarRating.js"></script>
<script>
var ratings = document.getElementsByClassName('rating');
for (var i = 0; i < ratings.length; i++) {
var r = new SimpleStarRating(ratings[i]);
ratings[i].addEventListener('rate', function(e) {
console.log('Rating: ' + e.detail);
});
}
</script>
</div>
</div>
</body>
</html>