-
Notifications
You must be signed in to change notification settings - Fork 2
/
Pay.html
262 lines (216 loc) · 6.21 KB
/
Pay.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!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>Payment</title>
<style>
*{
font-family: Arial, Helvetica, sans-serif;
}
#container {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
}
#paybox{
display: flex;
flex-direction: column;
align-items: start;
justify-content: center;
width: 75%;
padding: 40px;
margin-top: 0px;
gap: 5px;
color: white;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
border-radius: 25px;
}
form>h2{
color: white;
}
input{
width :80%
}
form {
display: flex;
flex-direction: column;
margin: auto;
width: 25%;
padding: 20px;
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
background-color: #0087a8;
justify-content: center;
align-items: center;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
border-radius: 25px;
}
img{
height: 100px;
width: 100px;
}
#submit {
margin: auto;
width: 91%;
margin-top: 5px;
background-color: #0087a8;
border: 1px solid white;
color: white;
border-radius: 10px;
}
input {
padding: 5px;
}
#gocart {
width: 100%;
display: flex;
}
#gocart>button {
margin: auto;
}
#paybox>div{
display: flex;
}
#message{
color: white;
font-weight: bold;
}
#formguide{
font-weight: bold;
font-size: 15px;
}
@media all and (min-width:770px) and (max-width:1180px){
form {
width: 75%;
}
#paybox{
width: 70%;
}
input{
width: 90%;
}
h2{
font-size: 25px;
}
}
@media all and (min-width:300px) and (max-width:770px){
form {
width: 75%;
}
#paybox{
width: 70%;
}
input{
width: 90%;
}
h2{
font-size: 15px;
}
}
</style>
</head>
<body>
<div id="container">
<form action="">
<img src="images/logo.png" alt="">
<h2>You are Paying Deccan Herald</h2>
<div id="paybox">
<div id="formguide"></div>
<label for="cardnumber" id="namelabel">Card No</label>
<input type="number" name="" id="cardnumber" value="">
<label for="cvv">CVV</label>
<input type="number" name="" id="cvv" value="">
<label for="date">Expiry Date</label>
<input type="month" id="date" value="">
<input type="submit" id="submit">
</div>
<div id="message"></div>
</form>
</div>
</body>
</html>
<script>
let cardflag = false
let cvvflag = false
let dateflag = false
cardmessage = document.createElement("p")
cvvmessage = document.createElement("p")
datemessage = document.createElement("p")
let guide = document.createElement("p")
let formguide = document.querySelector("#formguide")
formguide.append(guide)
let cardnumber = document.querySelector("#cardnumber")
cardnumber.addEventListener("input",function(){
event.preventDefault()
if((cardnumber.value).length === 16){
guide.innerText = ""
cardflag = true
message.innerHTML = ""
console.log(cardflag)
}else{
guide.innerText = "Enter your 16 digit Debit/Card Number"
cardnumberflag = false
}
})
let CVV = document.querySelector("#cvv")
CVV.addEventListener("input",function(){
event.preventDefault()
if((CVV.value).length === 3){
guide.innerText = ""
cvvflag = true
message.innerHTML = ""
console.log(cvvflag)
}else{
guide.innerText = "Enter your 3 digit CVV"
cvvflag = false
}
})
let date = document.querySelector("#date")
date.addEventListener("input",function(){
event.preventDefault()
if(date.value === ""){
dateflag = false
}else{
dateflag = true
message.innerHTML = ""
console.log(dateflag)
}
})
console.log(date.value)
let message = document.querySelector("#message")
let submit = document.querySelector("#submit")
submit.value =" Pay"
submit.addEventListener("click",function(){
event.preventDefault()
if(cardflag === true && cvvflag === true && dateflag === true ){
alert("done")
}else{
submit.addEventListener("click",boom)
}
})
function boom(){
if(cardnumber.value === ""){
cardmessage.innerText = "Please fill Card details first"
message.append(cardmessage)
}else{
message.innerHTML = ""
cardmessage.innerText = ""
}
if(CVV.value === ""){
cvvmessage.innerText = "Please fill CVV"
message.append(cvvmessage)
}else {
cvvmessage = ""
message.innerHTML = ""
}
if(date.value === ""){
datemessage.innerText = "Please set Expiry date of Your card "
message.append(datemessage)
}else{
datemessage.innerText = ""
message.innerHTML = ""
}
}
</script>