-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
43 lines (36 loc) · 923 Bytes
/
index.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
<!DOCTYPE html>
<html>
<head>
<title> Login</title>
</head>
<body>
Email <input type="email" name="email" placeholder="abc@abc.com" /><br>
Password <input type="password" name="pass" placeholder="password" /><br>
<input type="submit" onclick="validateAndLogin()" value="submit"/>
</body>
<script>
function validateAndLogin(){
var email = document.getElementsByName("email")[0].value;
var pass = document.getElementsByName("pass")[0].value;
if(email.length == 0 || !email.includes("@")){
alert('Invalid email');
}
else if( pass.length == 0){
alert('Password cannot be empty');
}
else
login(email,pass);
function login(a,b){
var user={
"email": "sid@test.com",
"password": "webtech"
};
if(a===user.email&&b===user.password){
alert('login success');
}
else
alert('login failed please try again');
}
}
</script>
</html>