Thursday, 21 May 2020

Registration Page 1



Registration.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="first.js"></script>
</head>

<body>
<form id="form_id" method="post" name="myform">
<center>

<h2>Registration Form</h2>
<table height="200" width="300" border="1">
<tr><td>First Name:</td> <td><input type="text"id="text1"></td></tr>
<tr><td>Mobile:</td><td><input type="text"id="text2"></td></tr>
<tr><td>Address:</td><td><input type="text"id="text3"></td></tr>
<tr><td>City:</td><td><input type="text"id="text4"></td></tr>
<tr><td>State:</td><td><input type="text"id="text5"></td></tr>
<tr><td>Pin:</td><td><input type="text"id="text6"></td></tr>

<tr>
<td>Username:</td>
<td><input type="text" name="username" id="username" placeholder="Ener username" /></td>
</tr>

 <tr>
<td>Password :</td>
<td><input type="password" name="password" id="password" placeholder="Ener Password" /></td></tr>
                                   
<tr>
<td></td>
<td><button class="button button1" onclick="validate1();">SAVE</button></td>
</tr>
                                   
</table>
</center>
</form>   
</html>
</body>

first.js

//javascript for registration

function validate1()
{
var name=document.getElementById("text1").value;
var mob=document.getElementById("text2").value;
var add=document.getElementById("text3").value;
var city=document.getElementById("text4").value;
var state=document.getElementById("text5").value;
var pin=document.getElementById("text6").value;

if(name==null||name=="")
alert("Name Should not be Null");

if(!isNaN(name))
alert("Name Should only contain Characters");

if(mob.length!=10)
alert("Mobile number should be exactly 10 digits long.");

if(add==null||add=="")
alert("Address Should not be Null.");

if(city==null||city=="")
alert("City Should not be Null.");

if(state==null||state=="")
alert("State Should not be Null.");

if(pin.length!=6)
alert("Pin Code should be exactly 6 digits long.");
}