-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest12.html
More file actions
43 lines (43 loc) · 1.38 KB
/
Copy pathTest12.html
File metadata and controls
43 lines (43 loc) · 1.38 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Option Select</title>
</head>
<body>
<select name="category" onchange="selected(this.value)">
<option value="computer">부품</option>
<option value="cloth">옷</option>
<option value="shoes">신발</option>
</select>
<script>
const products = {
COMPUTER: [
{ name: "GeForce RTX 4090" },
{ name: "AMD 9600X" },
{ name: "Intel i7-14700K" },
],
CLOTH: [
{ name: "Alpha Industries MA-1" },
{ name: "Acne Studios Shearling Jacket" },
],
SHOES: [
{ name: "Nike Air Max 97 Triple White" },
{ name: "Dr.Martens 1461 Leather Oxford" },
],
};
function selected(value) {
const selected_products = [];
const upperValue = value.toUpperCase();
if (upperValue === "COMPUTER") {
Object.assign(selected_products, products.COMPUTER);
} else if (upperValue === "CLOTH") {
Object.assign(selected_products, products.CLOTH);
} else if (upperValue === "SHOES")
Object.assign(selected_products, products.SHOES);
console.log(selected_products);
}
</script>
</body>
</html>