JavaScript to implement login form

JavaScript to implement login form

This article example shares the specific code of JavaScript to implement the login form for your reference. The specific content is as follows

Idea : Put the login window outside the interface, and then change it to the interface through the function in the script!

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>My Login Form</title>
    <style>
        .loginDiv{
            /*Set the appearance of the login box*/
            border: solid red 3px;
            border-radius: 10px;
            width: 350px;
            height: 250px;
            background-color: skyblue;
            /*Set the location of the login box*/
            position: absolute;
            top: -300px;
        }
        button{
            /*Set the button style*/
            border-radius: 3px;
        }
        #closeDiv{
            /*Set the close button position*/
            position: relative;
            top: -160px;
            left: 305px;
        }
    </style>
</head>
<body>
<a href="javaScript:login()" >Login window</a>
<div class="loginDiv" id="loginDiv">
    <h2 align="center">Login window</h2>
    <table align="center">
        <tr>
            <th>Username:</th>
            <th><input type="text"></th>
        </tr>
        <tr>
            <th>Password:</th>
            <th><input type="password"></th>
        </tr>
        <tr>
            <th colspan="2">
                <button>Login</button>&nbsp
                <button type="reset">Reset</button>
            </th>
        </tr>
    </table>
    <div id="closeDiv"><a href="javaScript:close()" >[Close]</a></div>
</div>
<script>
    function login() {
        //Get the login object let loginDivObj = document.getElementById("loginDiv");
        loginDivObj.style.top="100px";
        //Set transition properties, see transitionProperty: Specifies the name of the CSS property to which the transition effect is applied.
        // Reference 2: transitionDuration: specifies how many seconds or milliseconds it takes to complete the transition effect.
        // Parameter 3: transitionTimingFunction: specifies the speed curve of the transition effect.
        // Reference 4: transitionDelay: defines when the transition effect starts.
        loginDivObj.style.transition="top 600ms linear 500ms";
    }
    function close() {
        //Get the login object let loginDivObj = document.getElementById("loginDiv");
        loginDivObj.style.top="-300px";
    }
</script>
</body>
</html>

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • js implements the pop-up login box by clicking the pop-up window
  • JS realizes the background color gradient animation effect when clicking the login pop-up window

<<:  How to improve MySQL Limit query performance

>>:  The correspondence between Tomcat and JDK versions and the features of each Tomcat version

Recommend

A comprehensive summary of frequently used statements in MySQL (must read)

The knowledge points summarized below are all fre...

MySql sets the specified user database view query permissions

1. Create a new user: 1. Execute SQL statement to...

Summary of CSS gradient effects (linear-gradient and radial-gradient)

Linear-gradient background-image: linear-gradient...

How to understand Vue's simple state management store mode

Table of contents Overview 1. Define store.js 2. ...

A collection of common uses of HTML meta tags

What is a mata tag The <meta> element provi...

SQL Aggregation, Grouping, and Sorting

Table of contents 1. Aggregate Query 1. COUNT fun...

MySQL implements a solution similar to Oracle sequence

MySQL implements Oracle-like sequences Oracle gen...

Introduction to CSS3 color value RGBA and gradient color usage

Before CSS3, gradient images could only be used a...

A brief discussion on the correct approach to MySQL table space recovery

Table of contents Preliminary Notes Problem Repro...

How to operate MySql database with gorm

1. Setting case sensitivity of fields in the tabl...

How to implement blank space in Taobao with CSS3

Make a blank space for Taobao: When you shrink th...

50 lines of code to implement Webpack component usage statistics

background Recently, a leader wanted us to build ...

Docker data volume container creation and usage analysis

A data volume container is a container specifical...