-
Notifications
You must be signed in to change notification settings - Fork 3
/
12.1 if statements 2.html
35 lines (34 loc) · 1.41 KB
/
12.1 if statements 2.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
<html lang="en">
<head><title> If Statements 2</title>
</head>
<body>
<!-- code to see if the username and password is correct then login if not then show some error message-->
<p ><h1>ID and Password to Enter</h1></p>
<p><input type="text" placeholder="username" id="id"></p>
<p><input type="password" placeholder="*********" id="pass"></p>
<p><button id="login">Login</button></p>
<script type="text/javascript">
document.getElementById("login").onclick=function(){
var identered=document.getElementById("id").value;
var actualid="muazim6655";
var passentered=document.getElementById("pass").value;
var actualpass="6655";
if(identered==actualid && passentered==actualpass){
document.write("Login successfully!")
}
else if(identered=='' && passentered==''){
alert("Please enter id and password!")
}
else if(identered!=actualid && passentered!=actualpass ){
alert("Enter correct id and password!")
}
else if(identered!=actualid){
alert("Enter correct id!")
}
else{
alert("Enter correct password!")
}
}
</script>
</body>
</html>