forked from nagesh199/Nykaa-clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
discount.html
81 lines (79 loc) · 2.19 KB
/
discount.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
<!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>Document</title>
<style>
#dic_coupon {
width: 40%;
height: 600px;
border: 1px solid black;
margin-left: 60%;
}
#s_bag {
padding-top: 8px;
width: 100%;
height: 40px;
text-align: center;
font-weight: 600;
font-size: 20px;
}
#coupon {
width: 95%;
height: 60px;
border: 1px solid black;
margin: auto;
display: flex;
justify-content: space-around;
background-color: rgb(245, 245, 245);
border-radius: 10px;
}
p {
font-weight: 400;
}
::-webkit-scrollbar{
width: 1em;
}
::-webkit-scrollbar-track{
background: rgb(114, 112, 112);
border-radius: 30px;
margin-block: 5px;
}
::-webkit-scrollbar-thumb{
background: linear-gradient(#fc2779 ,black);
border-radius: 30px;
}
::-webkit-scrollbar-thumb:hover{
background:linear-gradient(#fc2779,grey) ;
}
::-webkit-scrollbar-track:hover{
background: rgb(65, 63, 63);
}
</style>
</head>
<body>
<div id ="dic_coupon">
<div id="s_bag">Shopping Bag</div>
<div id ="coupon">
<input type="text" id="input" />
<p onclick="discount()">Apply</p>
</div>
</div>
</body>
</html>
<script>
function discount(){
let getcpn = JSON.parse(localStorage.getItem("coupon"));
let couponValue = document.getElementById("input").value;
if(couponValue === "masai30"){
alert ("Coupon Accept");
let disTotal = getcpn-getcpn*0.30
localStorage.setItem("discpn",JSON.stringify(disTotal))
}
else {
alert("Coupon is not valid")
}
}
</script>