forked from shubham7668/hacktober
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
40 lines (34 loc) · 1003 Bytes
/
main.js
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
var email = document.forms['form']['email'];
var password = document.forms['form']['password'];
var email_error = document.getElementById('email_error');
var pass_error = document.getElementById('pass_error');
email.addEventListener('textInput', email_Verify);
password.addEventListener('textInput', pass_Verify);
function validated(){
if (email.value.length < 8) {
email.style.border = "1px solid red";
email_error.style.display = "block";
email.focus();
return false;
}
if (password.value.length < 6) {
password.style.border = "1px solid red";
pass_error.style.display = "block";
password.focus();
return false;
}
}
function email_Verify(){
if (email.value.length >= 8) {
email.style.border = "1px solid silver";
email_error.style.display = "none";
return true;
}
}
function pass_Verify(){
if (password.value.length >= 6) {
password.style.border = "1px solid silver";
pass_error.style.display = "none";
return true;
}
}