Loading, please wait...

A to Z Full Forms and Acronyms

registration form using js

Jun 04, 2018 Java Script, 504 Views
using js with hyml registration form create demo
<html>
<head>
<script>
function validation()
{

var name=document.RegistrationForm.Name;
if( name.value == "" )
{
alert( "Please Enter the name!" );
name.focus() ;
return false;
}

var email = document.RegistrationForm.EMail.value;
atpos = email.indexOf("@");
dotpos = email.lastIndexOf(".");

if (atpos < 1 || ( dotpos - atpos < 2 )) 
{
alert("Please enter correct email ID")
document.RegistrationForm.EMail.focus() ;
return false;
}

var password=document.RegistrationForm.Password;
var password1=document.RegistrationForm.Password1; 
if (password.value == "" || isNaN( password.value )) 
{
window.alert("Please enter your password");
password.focus();
return false;
}

if(password1.value=="")
{
window.alert("Please enter the repeat password");
password1.focus();
return false;
}

var psd=document.RegistrationForm.Password.value; 
var psd1=document.RegistrationForm.Password1.value; 

if(psd!=psd1){ 

alert("password must be same!"); 
return false; 
} 

}
</script>
</head>

<body>
<form name="RegistrationForm" onsubmit="return(validation());">
<h1>Registration Form</h1>

<p><b>Name: </b>
<input type="text" name="Name"></p>

<p for="email"><b>Email: </b>
<input type="text" name="EMail"></p>

<p for="password"><b>Password: </b>
<input type="password" name="Password" ></p>

<p for="password1"><b>Repeat Password: </b>
<input type="password" name="Password1" ></p>

<input type="submit" value="Register" name="Submit"> 

<div class="container">
<p>Already have an account? <a href="#">Sign in</a>.</p>
</div>
</form>

</body>
</html>
A to Z Full Forms and Acronyms

Related Article