forked from pappuDon11/sanscript-registation-page
-
Notifications
You must be signed in to change notification settings - Fork 1
/
registration 2.html
65 lines (56 loc) · 1.75 KB
/
registration 2.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
54
55
56
57
58
59
60
61
62
63
64
65
<html>
<head>
<style>
td{
padding:10;
}
</style>
<title>javascript</title>
</head>
<body>
<h1 align='center' >Registration Form Validation Using JavaScript</h1>
<form name='frm'>
<table align="center" border='2'>
<tr><td>First name</td><td><input type='text' id='ud' name='name' value=''/></td></tr><br>
<tr><td>Middle name</td><td><input type='text' id='mn' name='mname' value=''/></td></tr><br>
<tr><td>Last name</td><td><input type='text' id='lu' 'name='lname' value=''/></td></tr><br>
<tr><td>Mobile Number</td><td><input type='text' id='no' name='mono' value='' placeholder='mobile number max is 10'/></td></tr><br>
<tr><td>Email Id</td><td><input type='text' id='eid' name='email' value='' placeholder='sam@example.com'/></td></tr><br>
<tr><td align='center'><input type='submit' onclick='validatefield()'name='s' value='submit'/><td></tr>
</table>
<script language="javascript">
function validatefield()
{
var fname=document.getElementById("ud").value;
var mname=document.getElementById("mn").value;
var lname=document.getElementById("lu").value;
var mon=document.getElementById("no").value;
var email=document.getElementById("eid").value;
if (fname=="")
{
alert("Please provide first name");
}
if (mname=="")
{
alert("Please provide middle name");
}
if (lname=="")
{
alert("Please provide last name");
}
if (mon=="") {
alert("Please provide mobile number");
}
if (mon.length<10 || mon.length>10)
{
alert("Mobile number must be 10");
}
if (email=="")
{
alert("Please provide email address") ;
}
}
</script>
</form>
</body>
</html>