Login and Registration Form in HTML

Java script log in

  • Introduction with JS
  • Environment Setup
  • Embedding Java Script
  • JavaScript Syntax
  • JS dev Console
  • JavaScript Variables
  • JavaScript Data Types
  • JavaScript Operators
  • JavaScript Flow Control
  • JavaScript Strings
  • JavaScript Arrays
  • JavaScript Functions
  • JavaScript Advanced Functions
  • JavaScript Objects
  • JavaScript Error Handling
  • JS Regular Expressions
  • JS Dynamic Table
  • JS Dynamic Table 2
  • JS Dynamic Table 3
  • JS Dynamic Table 4
  • JS Dynamic Table 5
  • Reverse a number in JS
  • Find table of any number
  • Validate Input form
  • Calculate age in JS
  • Current Date and Time in JS
  • Data conversion in Java Script
  • String Operations in JS
  • Arithmetic operations in JS
  • Changes in HTML using JS function
  • Get File Extension in JS
  • Generate random data in JS
  • JS Array Example
  • Sorting in JS
  • Array to HTML table in JS
  • Simple Calculator in JS
  • Login registration in JS
  • Image validation
  • Remove Char in JS
  • Remove spaces in JS
  • Remove all vowels in JS
  • Swapping of character
  • Find strings and array length in JS
  • String to Sentence in JS
  • Sort string in alphabetical order
  • Print array of string in JS
  • Words Sorting in JS
  • Find specific character
  • Read String in JS
  • Random Quotes Generator in JS
  • Counter in JavaScript
  • Search in JS
  • Clock in Javascript
  • Quick Help
Читайте также:  Call JavaScript function on page load.

Simple login and registration page using JS

Create login and registration page using HTML and JavaScript. In this Java Script example, let’s create a simple web application to design and perform login and registration using HTML, CSS, and JS.

Problem statement

In this task, we have to create simple login and registration page using JS function, HTML, CSS. For that create an HTML file and use the js function that displays the output.

Steps to create login and registration page using JS

  • Create HTML file
  • Use CSS to Create two class title login and title register
  • Create login register buttons and submit buttons using html
  • In javascript to declare variables use const and use document. queryselector() that returns the first element within the document that matches the specified selector. const loginText = document.querySelector(“.title-text .login”);
  • Use signupBtn.onclick event executes a certain functionality when a button is clicked
  • Add margins to the login button use loginForm.style.marginLeft = “-50%”; loginText.style.marginLeft = “-50%”;
  • Use onclick buttons for login and register and add margin to that buttons .

JS code for login and registration page using HTML and CSS

      
Login Form
Registration Form
Login
Forgot password?
Register now
* < margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; >html,body < display: grid; height: 100%; width: 100%; place-items: center; background: #87CEEB; >::selection < background: #fa4299; color: #fff; >.wrapper < overflow: hidden; max-width: 390px; background: #fff; padding: 30px; border-radius: 5px; box-shadow: 0px 15px 20px rgba(0,0,0,0.1); >.wrapper .title-text < display: flex; width: 200%; >.wrapper .title < width: 50%; font-size: 35px; font-weight: 600; text-align: center; transition: all 0.6s cubic-bezier(0.68,-0.55,0.265,1.55); >.wrapper .slide-controls < position: relative; display: flex; height: 50px; width: 100%; overflow: hidden; margin: 30px 0 10px 0; justify-content: space-between; border: 1px solid lightgrey; border-radius: 5px; >.slide-controls .slide < height: 100%; width: 100%; color: #fff; font-size: 18px; font-weight: 500; text-align: center; line-height: 48px; cursor: pointer; z-index: 1; transition: all 0.6s ease; >.slide-controls label.signup < color: #000; >.slide-controls .slider-tab < position: absolute; height: 100%; width: 50%; left: 0; z-index: 0; border-radius: 5px; background: -webkit-linear-gradient(left, #a445b2, #fa4299); transition: all 0.6s cubic-bezier(0.68,-0.55,0.265,1.55); >input[type="radio"] < display: none; >#signup:checked ~ .slider-tab < left: 50%; >#signup:checked ~ label.signup < color: #fff; cursor: default; user-select: none; >#signup:checked ~ label.login < color: #000; >#login:checked ~ label.signup < color: #000; >#login:checked ~ label.login < cursor: default; user-select: none; >.wrapper .form-container < width: 100%; overflow: hidden; >.form-container .form-inner < display: flex; width: 200%; >.form-container .form-inner form < width: 50%; transition: all 0.6s cubic-bezier(0.68,-0.55,0.265,1.55); >.form-inner form .field < height: 50px; width: 100%; margin-top: 20px; >.form-inner form .field input < height: 100%; width: 100%; outline: none; padding-left: 15px; border-radius: 5px; border: 1px solid lightgrey; border-bottom-width: 2px; font-size: 17px; transition: all 0.3s ease; >.form-inner form .field input:focus < border-color: #fc83bb; >.form-inner form .field input::placeholder < color: #999; transition: all 0.3s ease; >form .field input:focus::placeholder < color: #b3b3b3; >.form-inner form .pass-link < margin-top: 5px; >.form-inner form .signup-link < text-align: center; margin-top: 30px; >.form-inner form .pass-link a, .form-inner form .signup-link a < color: #fa4299; text-decoration: none; >.form-inner form .pass-link a:hover, .form-inner form .signup-link a:hover < text-decoration: underline; >form .btn < height: 50px; width: 100%; border-radius: 5px; position: relative; overflow: hidden; >form .btn .btn-layer < height: 100%; width: 300%; position: absolute; left: -100%; background: -webkit-linear-gradient(right, #a445b2, #fa4299, #a445b2, #fa4299); border-radius: 5px; transition: all 0.4s ease;; >form .btn:hover .btn-layer < left: 0; >form .btn input[type="submit"]

Источник

Login and Registration Form in HTML CSS and JavaScript

Login and Registration Form in HTML CSS and JavaScript

Hello friend I hope you are doing awesome. Today here we will learn to create a Responsive Login and Registration Form in HTML CSS and JavaScript. You can also check out the 16 Free Login & Registration Forms that I have created to date. But this project has several facilities and features.

The login form is the section on the webpage where users need to fill required details to enter the particular website or webpage. Same as the Registration form is the section with a combination of input fields where users need to fill in details to create a login id and password.

Let’s have a quick look at the given image of our project [Login and Registration Form]. On the left side, we can see a login form with some input fields, buttons,s, and text with links, similarly, on the right side, we can see a registration form. Actually, at first, there will be one form which is the login form and when we click on the signup now button the login form will disappear and the registration form will appear.

Now we are going to watch the real demo of this project [Login and Registration Form], and all the animation that I have included in this template. Also by watching the video tutorial, we will get an idea, of how all HTML CSS and JavaScript code works properly behind this beautiful form design.

Login & Registration Form in HTML CSS JavaScript

I have provided all the HTML CSS and JavaScript code that I have used to create this beautiful Login and Registration Form, before Jumping into the source code file, you need to know some important points outs of this video tutorial.

As you have seen on the video tutorial of this Login and Registration Form. We saw only on the login form on the screen with the login title some input filed with beautiful focus animation and a button and some text and nav links and also we have seen password hide and show eye toggle button. When I clicked on the signup now link sign-up button disappear and the registration form appeared with a beautiful sliding animation.

Similarly, on the registration form, we have seen a title, an input field, a button, and some text with nav links. Again when I clicked on the Login now link, the registration form disappear and the login form appear.

For the UI design I have used only HTM and CSS and to toggle the Login and Registration Form and Password Show Hide feature I have used Some JavaScript code. If you want this type of Login and Registration Form in HTM and CSS Only then you can click the link.

I believe, now you can easily create this login form, if you are feeling difficulty, I have provided all the HTML CSS, and JavaScript code that I have used to create this Login and Registration Form below:

You Might Like This:

Login and Registration Form [Source Code]

To take the source code of this Login and Registration Form Template first, you need to create two files: an HTML file and a CSS file. After creating these two files then you can copy-paste the following source code. You can also directly download all source codes of this Login and Registration Form by clicking on the given download button.

              
Login
Forgot password?
Not a member? Signup Now
Registration
Already a member? Login Now

/* ===== Google Font Import — Poformsins ===== */ @import url(‘https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap’); * < margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; >body < height: 100vh; display: flex; align-items: center; justify-content: center; background-color: #4070f4; >.container < position: relative; max-width: 430px; width: 100%; background: #fff; border-radius: 10px; box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); overflow: hidden; margin: 0 20px; >.container .forms < display: flex; align-items: center; height: 440px; width: 200%; transition: height 0.2s ease; >.container .form < width: 50%; padding: 30px; background-color: #fff; transition: margin-left 0.18s ease; >.container.active .login < margin-left: -50%; opacity: 0; transition: margin-left 0.18s ease, opacity 0.15s ease; >.container .signup < opacity: 0; transition: opacity 0.09s ease; >.container.active .signup < opacity: 1; transition: opacity 0.2s ease; >.container.active .forms < height: 600px; >.container .form .title < position: relative; font-size: 27px; font-weight: 600; >.form .title::before < content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 30px; background-color: #4070f4; border-radius: 25px; >.form .input-field < position: relative; height: 50px; width: 100%; margin-top: 30px; >.input-field input < position: absolute; height: 100%; width: 100%; padding: 0 35px; border: none; outline: none; font-size: 16px; border-bottom: 2px solid #ccc; border-top: 2px solid transparent; transition: all 0.2s ease; >.input-field input:is(:focus, :valid) < border-bottom-color: #4070f4; >.input-field i < position: absolute; top: 50%; transform: translateY(-50%); color: #999; font-size: 23px; transition: all 0.2s ease; >.input-field input:is(:focus, :valid) ~ i < color: #4070f4; >.input-field i.icon < left: 0; >.input-field i.showHidePw < right: 0; cursor: pointer; padding: 10px; >.form .checkbox-text < display: flex; align-items: center; justify-content: space-between; margin-top: 20px; >.checkbox-text .checkbox-content < display: flex; align-items: center; >.checkbox-content input < margin-right: 10px; accent-color: #4070f4; >.form .text < color: #333; font-size: 14px; >.form a.text < color: #4070f4; text-decoration: none; >.form a:hover < text-decoration: underline; >.form .button < margin-top: 35px; >.form .button input < border: none; color: #fff; font-size: 17px; font-weight: 500; letter-spacing: 1px; border-radius: 6px; background-color: #4070f4; cursor: pointer; transition: all 0.3s ease; >.button input:hover < background-color: #265df2; >.form .login-signup

const container = document.querySelector(".container"), pwShowHide = document.querySelectorAll(".showHidePw"), pwFields = document.querySelectorAll(".password"), signUp = document.querySelector(".signup-link"), login = document.querySelector(".login-link"); // js code to show/hide password and change icon pwShowHide.forEach(eyeIcon =>< eyeIcon.addEventListener("click", ()=>< pwFields.forEach(pwField =>< if(pwField.type ==="password")< pwField.type = "text"; pwShowHide.forEach(icon =>< icon.classList.replace("uil-eye-slash", "uil-eye"); >) >else< pwField.type = "password"; pwShowHide.forEach(icon =>< icon.classList.replace("uil-eye", "uil-eye-slash"); >) > >) >) >) // js code to appear signup and login form signUp.addEventListener("click", ( )=>< container.classList.add("active"); >); login.addEventListener("click", ( )=>< container.classList.remove("active"); >);

If you face any difficulties while creating your Login and Registration Form or your code is not working as expected, you can download the source code files for this Login and Registration Page for free by clicking on the download button, and you can also view a live demo of this card slider by clicking on the view live button.

  • TAGS
  • Animated Login & Registration Form
  • css form
  • Form Design
  • free login form template
  • free registration form template
  • HTML and CSS
  • HTML CSS JavaScript
  • HTML Form
  • login & signup form with source code

Источник

JavaScript Form Validation With Limit Login Attempts

Login form plays a key role in website development, which authenticate user access to other resources.

Here, we are giving our JavaScript codes for validating Login form. In our example, we have a login form with two input fields i.e. username and password, As user clicks on login button, JavaScript validation function comes into act.

Moreover, we allowed three attempts for user to login, after third attempt all fields get disabled.

var attempt = 3; //Variable to count number of attempts . attempt --; //Decrementing by one . document.getElementById("username").disabled = true; document.getElementById("password").disabled = true; document.getElementById("submit").disabled = true; return false; > > >

Below is our complete code with download and live demo option

validating login form using javascript

HTML File: javascript_login.html

Here, we have created a simple HTML form with some fields, as user clicks submit button JavaScript code will execute.

        

Javascript Login Form Validation

Note : For this demo use following username and password.
User Name : Formget
Password : formget#123

Javascript File: login.js

Given below is our complete JavaScript code.

var attempt = 3; // Variable to count number of attempts. // Below function Executes on click of login button. function validate() < var username = document.getElementById("username").value; var password = document.getElementById("password").value; if ( username == "Formget" && password == "formget#123")< alert ("Login successfully"); window.location = "success.html"; // Redirecting to other page. return false; >else < attempt --;// Decrementing by one. alert("You have left "+attempt+" attempt;"); // Disabling fields after 3 attempts. if( attempt == 0)< document.getElementById("username").disabled = true; document.getElementById("password").disabled = true; document.getElementById("submit").disabled = true; return false; >> >

CSS File: style.css

/* Below line is used for online Google font */ @import url(http://fonts.googleapis.com/css?family=Raleway); h2 < background-color: #FEFFED; padding: 30px 35px; margin: -10px -50px; text-align:center; border-radius: 10px 10px 0 0; >hr < margin: 10px -50px; border: 0; border-top: 1px solid #ccc; margin-bottom: 40px; >div.container < width: 900px; height: 610px; margin:35px auto; font-family: 'Raleway', sans-serif; >div.main < width: 300px; padding: 10px 50px 25px; border: 2px solid gray; border-radius: 10px; font-family: raleway; float:left; margin-top:50px; >input[type=text],input[type=password] < width: 100%; height: 40px; padding: 5px; margin-bottom: 25px; margin-top: 5px; border: 2px solid #ccc; color: #4f4f4f; font-size: 16px; border-radius: 5px; >label < color: #464646; text-shadow: 0 1px 0 #fff; font-size: 14px; font-weight: bold; >center < font-size:32px; >.note < color:red; >.valid < color:green; >.back < text-decoration: none; border: 1px solid rgb(0, 143, 255); background-color: rgb(0, 214, 255); padding: 3px 20px; border-radius: 2px; color: black; >input[type=button] < font-size: 16px; background: linear-gradient(#ffbc00 5%, #ffdd7f 100%); border: 1px solid #e5a900; color: #4E4D4B; font-weight: bold; cursor: pointer; width: 100%; border-radius: 5px; padding: 10px 0; outline:none; >input[type=button]:hover

Pabbly Form Builder

Hence, we have applied JavaScript validation on login form, you can also use database to verify user. Hope you like it, keep reading our other blogs in future.

Источник

JavaScript Form Validation With Limit Login Attempts

Login form plays a key role in website development, which authenticate user access to other resources.

Here, we are giving our JavaScript codes for validating Login form. In our example, we have a login form with two input fields i.e. username and password, As user clicks on login button, JavaScript validation function comes into act.

Moreover, we allowed three attempts for user to login, after third attempt all fields get disabled.

var attempt = 3; //Variable to count number of attempts . attempt --; //Decrementing by one . document.getElementById("username").disabled = true; document.getElementById("password").disabled = true; document.getElementById("submit").disabled = true; return false; > > >

Below is our complete code with download and live demo option

validating login form using javascript

HTML File: javascript_login.html

Here, we have created a simple HTML form with some fields, as user clicks submit button JavaScript code will execute.

        

Javascript Login Form Validation

Note : For this demo use following username and password.
User Name : Formget
Password : formget#123

Javascript File: login.js

Given below is our complete JavaScript code.

var attempt = 3; // Variable to count number of attempts. // Below function Executes on click of login button. function validate() < var username = document.getElementById("username").value; var password = document.getElementById("password").value; if ( username == "Formget" && password == "formget#123")< alert ("Login successfully"); window.location = "success.html"; // Redirecting to other page. return false; >else < attempt --;// Decrementing by one. alert("You have left "+attempt+" attempt;"); // Disabling fields after 3 attempts. if( attempt == 0)< document.getElementById("username").disabled = true; document.getElementById("password").disabled = true; document.getElementById("submit").disabled = true; return false; >> >

CSS File: style.css

/* Below line is used for online Google font */ @import url(http://fonts.googleapis.com/css?family=Raleway); h2 < background-color: #FEFFED; padding: 30px 35px; margin: -10px -50px; text-align:center; border-radius: 10px 10px 0 0; >hr < margin: 10px -50px; border: 0; border-top: 1px solid #ccc; margin-bottom: 40px; >div.container < width: 900px; height: 610px; margin:35px auto; font-family: 'Raleway', sans-serif; >div.main < width: 300px; padding: 10px 50px 25px; border: 2px solid gray; border-radius: 10px; font-family: raleway; float:left; margin-top:50px; >input[type=text],input[type=password] < width: 100%; height: 40px; padding: 5px; margin-bottom: 25px; margin-top: 5px; border: 2px solid #ccc; color: #4f4f4f; font-size: 16px; border-radius: 5px; >label < color: #464646; text-shadow: 0 1px 0 #fff; font-size: 14px; font-weight: bold; >center < font-size:32px; >.note < color:red; >.valid < color:green; >.back < text-decoration: none; border: 1px solid rgb(0, 143, 255); background-color: rgb(0, 214, 255); padding: 3px 20px; border-radius: 2px; color: black; >input[type=button] < font-size: 16px; background: linear-gradient(#ffbc00 5%, #ffdd7f 100%); border: 1px solid #e5a900; color: #4E4D4B; font-weight: bold; cursor: pointer; width: 100%; border-radius: 5px; padding: 10px 0; outline:none; >input[type=button]:hover

Pabbly Form Builder

Hence, we have applied JavaScript validation on login form, you can also use database to verify user. Hope you like it, keep reading our other blogs in future.

Источник

Оцените статью