-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform2.html
43 lines (37 loc) · 1010 Bytes
/
form2.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
<html>
<head>
<script type="text/javascript">
function fun(){
var a=document.getElementById("txt");
var b=document.getElementById("pass");
if(a.value==""){
//alert("enter user");
a.style.border="solid 3px red";
document.getElementById("lab").style.visibility="visible";
return false;
}
else if(b.value.trim()==""){
alert("enter pass");
return false;
}
else if(b.value.trim().length<5){
alert("pass is too small");
return false;
}
else{
return true;
}
}
</script>
</head>
<body>
<form onsubmit="return fun()" action="ref.html">
<input id="txt" placeholder="enter_name" type="text"/>
<br><br>
<input id="pass" placeholder="enter_pass" type="password"/>
<br><br>
<button type="submit">click me</button>
<label id="lab" style="color: red; visibility:hidden;">Invalid</label>
</form>
</body>
</html>