-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.html
138 lines (119 loc) · 5.14 KB
/
cart.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cart</title>
<link rel="stylesheet" href="homecss.css">
</head>
<body>
<div class="cont">
<div class="header">
<a href="home.html"><img src="Teamm.png" alt=""></a>
<h1 id="headtext">Team Intern</h1>
<button id="cart"><a href="cart.html">
<img src="https://cdn-icons-png.flaticon.com/128/2169/2169842.png" alt=""></a>
</button>
<button id="sign"><a href="log_in.html">Sign In</a></button>
<button id="log"><a href="signup.html">Sign Up</a></button>
</div>
<input type="checkbox" id="opensidebarmenu">
<label for="opensidebarmenu" class="sidebaricontoggle">
<div class="spinner top"></div>
<div class="spinner middle"></div>
<div class="spinner bottom"></div>
</label>
<div id="sidebarmenu">
<ul class="menu">
<li><a href="home.html">Home</a></li>
<li><a href="course.html">Internship</a></li>
<li><a href="#">Jobs</a></li>
<li><a href="cart.html">Cart</a></li>
<li><a href="course.html">Courses</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="signup.html">Register</a></li>
<li><a href="log_in.html">Log In</a></li>
</ul>
</div>
<div id="main">
<div class="course"></div>
<div class="seventh">
<div class="seven1">
<div class="seven2">
<img src="https://cdn-icons-png.flaticon.com/128/665/665209.png" alt="">
<img src="https://cdn-icons-png.flaticon.com/128/61/61109.png" alt="">
<img src="https://cdn-icons-png.flaticon.com/128/1384/1384017.png" alt="">
<img src="https://cdn-icons-png.flaticon.com/128/1400/1400829.png" alt="">
</div>
<div class="seven2">
<h2 class="seven2h">BY PLACE</h2>
<h3>Internship In Mumbai</h3>
<h3>Internship In Delhi</h3>
<h3>Internship In Bangalore</h3>
<h3>Internship In Pune</h3>
<h3>Internship In Hyderabad</h3>
</div>
<div class="seven2">
<h2 class="seven2h2">BY PROFILE</h2>
<h3>Marketing Internship</h3>
<h3>Business Devlopment Internship</h3>
<h3>Content Writing Internship</h3>
<h3>Graphic Designing Internship</h3>
<h3>HR Internship</h3>
<h3>Engineering Internship</h3>
</div>
<div class="seven2">
<h2 class="seven2h2">BY TYPE</h2>
<h3>Full Time Internship</h3>
<h3>Part Time Internship</h3>
<h3>Work From Home Internship</h3>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<script>
let data = JSON.parse(localStorage.getItem("cart"))
display(data)
function display(data) {
document.querySelector(".course").innerHTML = ""
data.forEach(element => {
let flag = true
let div = document.createElement("div")
div.setAttribute("class", "cbox")
let title = document.createElement("h2")
title.innerText = element.Title
let dist = document.createElement("p")
dist.innerText = element.Disc
let cate = document.createElement("h3")
cate.innerText = "Category: " + element.Cate
let cutprice = document.createElement("s")
cutprice.setAttribute("class", "cutp")
cutprice.innerText = "Rs." + Math.floor(element.Price * 1.1)
let price = document.createElement("h3")
price.setAttribute("class", "pp")
price.innerText = "Rs." + element.Price
let image = document.createElement("img")
image.setAttribute("src", element.image)
butt=document.createElement("button")
butt.setAttribute("class", "carta")
butt.innerText = "Buy Now"
butt.addEventListener("click", function () {
console.log(flag)
if (flag) {
alert("Product Added To Cart")
cart.push(element)
localStorage.setItem("cart", JSON.stringify(cart))
flag = false
} else {
alert("Product Already in Cart")
}
})
div.append(image, title, dist, cate, cutprice, price, butt)
document.querySelector(".course").append(div)
});
}
</script>