0% found this document useful (0 votes)
21 views1 page

Js

The document contains a JavaScript function for user login validation. It checks for a valid email format, ensures that the username and password fields are not empty, and verifies that the password length is exactly 6 characters. If all conditions are met, it redirects the user to the Campuslife website; otherwise, it displays appropriate alert messages for any errors.

Uploaded by

Ne kola Juric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Js

The document contains a JavaScript function for user login validation. It checks for a valid email format, ensures that the username and password fields are not empty, and verifies that the password length is exactly 6 characters. If all conditions are met, it redirects the user to the Campuslife website; otherwise, it displays appropriate alert messages for any errors.

Uploaded by

Ne kola Juric
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

function login()

{
var uname = [Link]("email").value;
var pwd = [Link]("pwd1").value;
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(uname =='')
{
alert("please enter user name.");
}
else if(pwd=='')
{
alert("enter the password");
}
else if(![Link](uname))
{
alert("Enter valid email id.");
}
else if([Link] < 6 || [Link] > 6)
{
alert("Password min and max length is 6.");
}
else
{
alert('Thank You for Login & You are Redirecting to Campuslife Website');
//Redirecting to other page or webste code or you can set your own html page.
[Link] = "[Link]
}
}
//Reset Inputfield code.
function clearFunc()
{
[Link]("email").value="";
[Link]("pwd1").value="";
}

You might also like