-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathIfElseDemo.html
More file actions
66 lines (64 loc) · 2.12 KB
/
IfElseDemo.html
File metadata and controls
66 lines (64 loc) · 2.12 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<style>
#popup {
width:300px;
height: 200px;
margin: auto;
position:fixed;
top:100px;
left:200px;
display:none;
}
</style>
<script>
var data = {
userName: 'john_ui',
password: 'john123'
};
function VerifyDetails() {
var uname = document.getElementById("txtName").value;
var pwd = document.getElementById("txtPwd").value;
var popup = document.getElementById("popup");
if(uname==data.userName && pwd==data.password) {
location.href="../home.html";
} else {
popup.style.display = "block";
}
}
function OkClick() {
document.getElementById("popup").style.display = "none";
}
</script>
</head>
<body>
<div class="container">
<h2>User Login</h2>
<div class="form-group">
<label>User Name</label>
<div>
<input class="form-control" type="text" id="txtName">
</div>
</div>
<div class="form-group">
<label>Password</label>
<div>
<input class="form-control" type="password" id="txtPwd">
</div>
</div>
<div class="form-group">
<button class="btn btn-primary" onclick="VerifyDetails()">Login</button>
</div>
<div class="card" id="popup">
<div class="card-body">
<h3 class="text-danger">Invalid User Name / Password</h3>
</div>
<div class="card-footer">
<button class="btn btn-danger" onclick="OkClick()">OK</button>
</div>
</div>
</div>
</body>
</html>