How to create a simple login page that checks username and password


This is a simple webpage using to create login page which check the username and password.The username and password is already given to the variable by declaring along with the variable.







<html>
<head>
<script>
function login()
{
var a,b,username=jinoy,password=@cspsyco;

a=document.getElementById("name").value;
b=document.getElementById("pass").value;
if(username==name){if(pass=password) 

<a href="http://cspsyco.blogspot.com"> 
 } 
else
{
document.write("password is incorrect"); 

}
else
{
document.write("username is incorrect"); 

}
</script></head><body bgcolor="blue">
<center>
<br><br><br><br>
<form>
User name:<input type="text" id="name">
<br><br>
Password:<input type="text" id="pass">
<br><br>
<input type="submit" onclick="login()">
&nbsp;&nbsp;
<input type="reset">
</form>
</center>
</body>
</html>


Here in the program we declare variables a and b with their values this value sir then checked with the the entered details if the condition of the username is satisfied then and it  execute the next if statement which checks the password. If the username didn't match then it is print username is incorrect. If the password and username we entered is correct then the web page redirects to the next page as given in the a tag. the function will only works when we hit the submit button when we hit the submit button the function login() works. there is a reset button also provide within the webpage to reset the contents that we ended in the form tag. I think that you understand well about how a simple login page works. Stay updated.

Comments

  1. How can i use this code in the blogger blog

    ReplyDelete
    Replies
    1. Copy and paste this code on the html section of your page. Change the user name and password in the JavaScript section that i put in the code

      Delete

Post a Comment

Popular posts from this blog

Node.js Cheat Sheet

Codeigniter ! Simple But Powerful

Introducing Cloudflare Pages ⚡