Thursday 18 January 2018

How to make an error handling form using html and javascript



Validation with javaScript.


Hello! Friends in this post i will show you how you can handle user input in a login form using javascript. 

So, here's the code.


<html>
<head>
<title>checking user input </title>
<script type="text/javascript">
function check ()
{
if (document.form1.username.value="" :: document.form1.password.value="")
{
alert ("username or password field is empty");
}
else
if (document.form1.password.value="continue" && document.form1.username.value="continue")
{
alert ("correct password and username");
}
else
{
alert ("wrong password or username");
}
}
</script>
</head>
<body>
<form name="form1">
Username
<input type="text" name="username" value="">
Password
<input type="password" name="password" value="">
<input type="button" value="Submit" onclick="check">
<input type="clear" value="Clear">
</body>
</html>

    Comming soon          advanced data validation using javascript which can be used to make sqli (sql injection) resistant login forms.

Comment your suggestions regarding this post.
Be happy and have fun.

Follow for more.....................................................................


See also
1. how to make a key logger using c++.
         
2. make a gui calculator without using javascript.
           
3. google trick.

No comments:

Post a Comment