-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataformat.html
41 lines (39 loc) · 1.11 KB
/
dataformat.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
<html>
<head>
<title>datavalidiation</title>
<script type="text/javascript">
function validiate()
{
var uname=document.getElementById("uname");
var pass=document.getElementById("pass");
if(uname.value.trim()=="")
{
alert("blank username");
uname.style.border="solid 3 px red";
return false;
}
else if(pass.value.trim()=="")
{
alert("blank password");
return false;
}
else if(pass.value.trim().length<5)
{
alert("password is too short");
return false;
}
else{
return true;
}
}
</script>
</head>
<body>
<form onsubmit="return validiate()";
action="message2.html">
<input id="uname" placeholder="username" type="text"/><br><br>
<input id="pass" placeholder="password" type="password"/><br><br>
<button onclick="validiate()" type="submit">submit</button>
</form>
</body>
</html>