-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
149 lines (139 loc) · 3.67 KB
/
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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>log in</title>
<style>
*{
box-sizing:border-box;
margin: 0;
padding: 0;
}
body{
background:url(/image/photo.jpg) no-repeat ;
background-size: cover;
display: flex;
flex-direction: column;
justify-content:center;
align-items: center;
height: 100vh;
}
.title{
color: aqua;
font-weight: bold;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
.box{
width: 300px;
height: 350px;
box-shadow: 0 5px 5px 5px rgba(2, 152, 198, 0.5);
background-color:goldenrod;
margin: 20px;
border-radius: 10%;
}
.email{
color:rgb(20, 2, 73);
}
input{
padding-top: 10px;
padding: 5px;
width: 100%;
border-radius: 5px;
border: 1px solid silver;
}
input[type=submit]{
background-color: blue;
cursor: pointer;
}
h1{
text-align: center;
margin-left:30px;
margin-top: 5px;
}
.pass{
color: rgb(20, 2, 73);
display: inline-block;
}
.login_form{
margin: 50px;
font-weight: bold;
font-size: 60px;
font-family: 'Times New Roman', Times, serif;
font-size: large;
}
#log{
color:white;
padding:5px;
margin-top:20px;
}
#error-email,#error-password{
font-weight: normal;
display: inline;
width: 100%;
font-size: 15px;
margin-top: 5px;
border:1px solid red;
background-color: rgba(239, 65, 65,0.4);
display: none;
}
</style>
</head>
<body>
<div class="contener">
<form action="" id="form">
<div class="title">POLICE MANAGEMENT SYSTEM</div>
<div class="box">
<div class="login_note">
<h1>user login</h1>
</div>
<div class="login_form">
<div class="email">
<label for="email">email</label>
<input type="email" name="email" id="email">
</div>
<div class="pass">
<label for="password">password</label>
<input type="password" name="password" id="password">
</div>
<div class="login">
<input type="submit" value="log in" id="log">
</div>
</div>
<div class="error"></div>
</div>
</form>
</div>
<script>
alert("hello");
const form = document.querySelector("#form");
const email = document.querySelector("#email");
const password = document.querySelector("#password");
const error = document.querySelector(".error");
form.addEventListener('submit',(e) =>{
e.preventDefault();
let error_message = [];
if(password.value.length <6){
error_message.push("password cannot be less than 6");
password.style.border='1px solid red';
}
if(email.value === ''){
error_message.push('email cannot be empty');
email.style.border='1px solid red';}
else{
email.style.border='1px solid green';
}
if(password.value === ''){
error_message.push('password must not empty');
password.style.border = '1px solid red';}
else{
password.style.border='2px solid green';
}
error.style.color='red';
error.style.background='pink';
error.textContent=error_message.join(',');
});
</script>
</body>
</html>