-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathmultiLevelConditions.html
More file actions
75 lines (75 loc) · 2.84 KB
/
multiLevelConditions.html
File metadata and controls
75 lines (75 loc) · 2.84 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
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
var userDetails = {
CardNo: "5555666688887777",
Year:"2019",
Cvv:"3344"
};
function VerifyCard() {
window.cardnumber = document.getElementById("txtCard").value;
if(userDetails.CardNo==cardnumber) {
document.getElementById("lstYear").disabled=false;
}
}
function VerifyYear(){
window.year = document.getElementById("lstYear").value;
if(userDetails.Year==year) {
document.getElementById("txtCvv").disabled=false;
}
}
function VerifyCvv(){
window.cvv = document.getElementById("txtCvv").value;
if(userDetails.Cvv==cvv) {
document.getElementById("btnPay").disabled=false;
}
}
function PayClick(){
var msg = document.getElementById("msg");
msg.className="text-danger";
if(cardnumber==userDetails.CardNo){
if(year==userDetails.Year) {
if(cvv==userDetails.Cvv){
document.write("Payment Successfull..");
} else {
msg.innerHTML="Invalid CVV";
}
} else {
msg.innerHTML="Invalid Year";
}
} else {
msg.innerHTML="Invalid Card Number";
}
}
</script>
</head>
<body>
<div class="container">
<fieldset>
<legend class="text-primary">Payment Details</legend>
<dl>
<dt>Card Number</dt>
<dd><input type="text" id="txtCard" class="form-control" onkeyup="VerifyCard()"></dd>
<dt>Expiry Year</dt>
<dd>
<select disabled id="lstYear" class="form-control" onchange="VerifyYear()">
<option>2019</option>
<option>2020</option>
<option>2021</option>
</select>
</dd>
<dt>CVV</dt>
<dd>
<input disabled type="text" id="txtCvv" class="form-control" onkeyup="VerifyCvv()">
</dd>
</dl>
<button id="btnPay" disabled class="btn btn-primary" onclick="PayClick()">Pay</button>
</fieldset>
<div class="form-group text-center">
<h3 id="msg"></h3>
</div>
</div>
</body>
</html>