-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.js
More file actions
34 lines (34 loc) · 1.04 KB
/
style.js
File metadata and controls
34 lines (34 loc) · 1.04 KB
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
function validate() {
let x = document.forms["myForm"]["animi-name"].value;
let y = document.forms["myForm"]["no"].value;
var special = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+/;
if (x == "") {
document.getElementById("demo").innerHTML = "* name cannot be empty";
return false;
}
if (x.length < 8){
document.getElementById("demo").innerHTML = "* should be atleast 8 charectors";
return false;
}
if (x.length > 15){
document.getElementById("demo").innerHTML = "* should not exceed 15 charectors";
return false;
}
if (x.indexOf(' ') >= 0 ){
document.getElementById("demo").innerHTML = "* should not have space between charectors";
return false;
}
if (isNaN(y))
{
document.getElementById("demo1").innerHTML = "* only number should be given";
return false;
}
if(special.test(x)){
document.getElementById("demo").innerHTML = "* special charectors are not allowed";
return false;
}
else
{
return true;
}
}