forked from Sharma-NareshIT/WebDevelopment-11AM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathifElse.html
55 lines (54 loc) · 2.28 KB
/
ifElse.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
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<script>
var userDetails = {
UserName: "john",
Password: "john123"
};
function VerifyUser() {
var userName = document.getElementById("txtName").value;
var password = document.getElementById("txtPwd").value;
if(userName==userDetails.UserName && password==userDetails.Password) {
location.href="Success.html";
} else {
document.getElementById("error").style.display = "block";
document.getElementById("frm").style.opacity = "0.3";
}
}
function CloseClick() {
document.getElementById("error").style.display = "none";
document.getElementById("frm").style.opacity = "1.0";
}
</script>
</head>
<body>
<div class="container">
<form id="frm">
<h2 class="form-text">User Logn</h2>
<div class="form-group">
<label>User Name</label>
<div>
<input type="text" id="txtName" class="form-control">
</div>
</div>
<div class="form-group">
<label>Password</label>
<div>
<input type="password" id="txtPwd" class="form-control">
</div>
</div>
<div class="form-group">
<input onclick="VerifyUser()" type="button" value="Login" class="btn btn-primary btn-block">
</div>
</form>
<div style="display:none; margin-top:-150px ; position:fixed" id="error" class="alert alert-danger">
<h2 class="alert-heading">Invalid User Name / Password </h2>
<p class="text-danger">Please verify your user name and password.</p>
<input type="button" value="X" class="btn btn-danger" onclick="CloseClick()">
</div>
</div>
</body>
</html>