Professional Documents
Culture Documents
EXPERIMENT 4
Aim:
Validate the designed Login and Registration pages using JavaScript.
login.html:
<html>
<head>
<script>
function check()
{
var password,Email,temp;
password=document.getElementById("pw");
Email=document.getElementById("em");
if(password.value=="" && Email.value=="")
{
alert("enter the details");
}
if(password.value=="")
{
alert("Please enter Password");
}
else
{
temp=/^(?=.\d)(?=.[a-z])(?=.*[A-Z])[a-z 0-9 A-Z]{8,32}$/
if(!(temp.test(password.value)))
{
alert("Invalid Password");
}
}
if(Email.value=="")
{
alert("Please enter E-mail");
}
else
{
temp=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/
if(!(temp.test(Email.value)))
{
alert("Invalid Mail");
}
registration.html: