hello , friends i am back with my new post. i f you need javascript validation then yes, you are in right place. copy below code in to your website .this code only for login validation for chacking user authentication .
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>javas_qet1</title>
<style>
#errorbox1{color:#F00;}
#errorbox2{color:#F00;}
#errorbox3{color:#F00;}
form{
height:700px;
width:500px;
background-color:#CCC;}
input[type=text] , input[type=password]{
background-color:#99C;
margin:30px 30px;
padding:12px 40px;}
</style>
<script>
function login()
{
var fusername=document.form.username.value;
var fpassword=document.form.password.value;
if(fusername== "")
{
document.form.username.focus();
document.getElementById("errorbox1").innerHTML="you didn't entered username ! ";
return false;
}
if(fpassword== "")
{
document.form.password.focus();
document.getElementById("errorbox2").innerHTML=("you didn't entered password yet !")
return false;
}
if(fpassword.length>=6 || fpassword.length <=18)
{
document.getElementById("errorbox2").innerHTML=(" password length between 6 to 18 ");
return false;
}
}
</script>
</head>
<body>
<center>
<form name="form" onsubmit="return login(this)"><br />
<br />
<h4 id="errorbox1"></h4>
<br />
username:<input type="text" name="username" />
<br />
<br />
<br />
<h4 id="errorbox2"></h4>
password:<input type="password" name="password"/>
<br />
<br />
<input type="submit" name="submit" />
<div id="errorbox3"></div>
</form>
</center>
</body>
</html>
thanks for visit . stay turned . new post available soon .
if you like this then share it to your friends .
keep visiting ANICISTAN.
Tags:
html/css