-
Notifications
You must be signed in to change notification settings - Fork 0
/
Javascript validation.html
53 lines (52 loc) · 1.35 KB
/
Javascript validation.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
<html>
<head>
<title> title of the </title>
<script type="text/javascript">
function validate()
{
var name=document.getElementById ("name").value;
var username=document.getElementById("username").value;
var reusername=document.getElementById("reuserame").value;
var password=document.getElementById("passsword").value;
var age=document.getElementById("age").value;
var email=document.getElementById("email").value;
var atpos=email.lastindexof("@").value;
var dotpos=email.lastindexof(".").value;
if (name=="// name.length<1")
{
document.write("Name is empty");
return false;
}
if (username==""|| Username.length<1)
{
document.write ("username is empty");
return false;
}
if (username!=reusername)
{
document.write ("username & reusername is not same");
return false;
}
if (password=""||password.length<6)
{
document.write("password is less than 6 characters");
return false;
}
if (age=="" || is (age))
{
document.write ("Age is not a number");
return false;
}
if (atpos<2 ||(dotpos-atpos)<2)
{
document.write ("email format is not correct");
return false;
}
}
</script>
</head>
<body>
<form method ="POST">
</form>
</body>
</html>