Python Web tries not to use the framework and writes out a management system by itself.

management system

Python Web tries not to use the framework and writes out a management system by itself.

I want to make a record to see if I can stick to the habit of taking notes. Xiao Bai, to write in a way that is as good as possible, may be very cumbersome, but the key is to grasp the train of thought, no way, no teacher, but I will write slowly, but I will try to write more carefully. road

It has not yet determined what management system to write, first write the login registration, then look at what system to write, anyway, it is the management system.

Day 1: Front-end html, css

login.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>System login</title>
    <link rel="stylesheet" type="text/css" href="../CSS/Login.css"><!--Introduce css-->
    <script type="text/javascript" src="../JavaScript/Login.js"></script><!--Introduce js-->
</head>
<body>
    <div class="div_all">
        <form action="../Python/Login.py" method="post">
        <h3 class="h3_Login">Welcome to the system</h3>
        <label class="Label_Login" >
            use&nbsp household&nbsp Name:<input type="text" id="username" name="username">&nbsp&nbsp&nbsp<i id="error_box1"></i>
            <!--id It's for giving. css Harmony is for use name Intend to leave py Not for the time being. py There's a bit of a jam. Wait for good ideas.-->
        </label><br><br>
        <label class="Label_Login">
            dense&nbsp&nbsp&nbsp&nbsp&nbsp Code:<input type="password" id="password" name="password">&nbsp&nbsp&nbsp<i id="error_box2"></i>
            <!--js Used ID Be sure to put it in the right place. If I put it in the wrong place before, I can't get it. input Value inside-->
        </label><br><br>
        <div class="div_one">
            <button type="submit" class="button_style" onclick="fnLogin()">Land</button>
             <!--fnLogin(): : js Method-->
            <a href="Register.html">
                <input type="button" class="button_style" name="regist" value="register">
            </a>
        </div>
            </form>
    </div>
</body>
</html>

register.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>System registration</title>
    <link rel="stylesheet" type="text/css" href="../CSS/Register.css">
    <script type="text/javascript" src="../JavaScript/Register.js"></script>
</head>
<body>
    <div class="div_all">
        <h3 class="h3_Login">Welcome to register this system</h3>
        <label class="Label_Register">
            use&nbsp household&nbsp name&nbsp: <input type="text" id="user_name">&nbsp&nbsp&nbsp<i id="error_box1"></i><br><br>
        </label><br>
        <label class="Label_Register">
            surname&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Name:<input type="text" id="name"><br><br>
        </label><br>
         <label class="Label_Register">
           year&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Age:<input type="text" id="age"><br><br>
        </label><br>
        <label class="Label_Register">
           hand&nbsp machine&nbsp Number&nbsp: <input type="text" id="phone"><br><br>
        </label><br>
        <label class="Label_Register">
            Mail box:<input type="email" id="email"><br><br>
        </label><br>
         <label class="Label_Register">
            Login password:<input type="password" id="password">&nbsp&nbsp&nbsp<i id="error_box3"></i><br><br>
        </label><br>
        <label class="Label_Register">
            Confirm password:<input type="password" id="repassword">&nbsp&nbsp&nbsp<i id="error_box4"></i><br><br>
        </label><br>
        <div class="div_one">
            <input type="button" class="button_style" onclick="cancel()" value="cancel">
            <input type="button" class="button_style" onclick="checkform()" value="register">
        </div>
    </div>
</body>
</html>

login.css

body{background-color: aliceblue;}
.div_all{margin: auto; height: 1000px;width: 1024px;border: 1px solid red}/* Set the position, background, border, width and height of css. */
.h3_Login{text-align: center;margin-top: 50px;color: black;font-size: 32px; }
.Label_Login{margin-left:350px; }
.div_one{margin-left: 350px}
.button_style{height:30px;width:100px;background-color: aqua;margin-left: 30px

register.css

body{background-color: aliceblue;}
.div_all{margin: auto; ; height: 1000px;width: 1024px;}/* Set the position, background, border, width and height of css. */
.h3_Login{text-align: center;margin-top: 50px;color: black;font-size: 32px;}
.Label_Register{margin-left:350px;}
.div_one{margin-left: 350px}
.button_style{height:30px;width:100px;background-color: aqua;margin-left: 30px;}

The second day: js

js I really do not understand, only the basic functions of the implementation of the line, do not ask too much.

login.js

function fnLogin() {
    var user_name = document.getElementById("username")
    var password = document.getElementById("password");
    var error1 = document.getElementById("error_box1");
    var error2 = document.getElementById("error_box2");
    /*Get the ID value in HTML, and provide parameters for the following methods, not just ID, but also name,,, (OK, I only know ID and name)*/
    var is_error = true;
    if(user_name.value==" "){
        error1.innerHTML = "*User name cannot be empty";
        is_error =false;
        return;
    }else if (user_name.value.length >20 || user_name.value.length<6){
        error1.innerHTML = "*Enter 6 for username-20 Bit character";
        is_error = false;
        return;
    }
    if (password.value.length > 20 || password.value.length < 6) {
        error2.innerHTML = "*Password please enter 6-20 Bit character";
        is_errorrror = false;
        return;
    }
    window.location.href = "../HTML/mian.html"
    /*Verify the successful jump page, in fact, there is no background processing, this is a false jump... Note that the path must be written correctly. Otherwise, you won't even make a false jump.*/
}

registee.js

#Write down the login, the basic registration will be, generally the same, that is, some of the conditions of the judgment is different, I am lazy, I did the user name, password authentication, want to do other self.
function cancel(){
  window.location.replace("../HTML/Login.html")
}
function checkform(){
    var user_name = document.getElementById("user_name")
    var name = document.getElementById("name")
    var age = document.getElementById("age")
    var phone = document.getElementById("phone")
    var email = document.getElementById("email")
    var password = document.getElementById("password")
    var repassword = document.getElementById("repassword")
    var error1 = document.getElementById("error_box1")
    var error2 = document.getElementById("error_box2")
    var error3 = document.getElementById("error_box3")
    var error4 = document.getElementById("error_box4")
    if(user_name.value==""){
        error1.innerHTML = "* User name cannot be empty";
        is_error =false;
        return;
    }else if (user_name.value.length>20 && user_name.value.length<6){
        error1.innerHTML = "* Enter 6 for username-20 Bit character";
        is_error = false;
        return;
    }
    if (password.value.length > 20 || password.value.length < 6) {
        error3.innerHTML = "* Password please enter 6-20 Bit character";
        is_error = false;
        return;
    }
    if (password.value != repassword.value){
        error4.innerHTML = "* The password does not match. Please re-enter it.";
        is_error = false;
        return;
    }
    window.alert("login was successful")
    window.location.href = "../HTML/Login.html"
}

Today, I went to py's place and found myself using the frame. I don't know how to get the number from the front end without the frame, or how to learn it by myself. I'll study it first and understand that I'm on it.

Keywords: Javascript Python

Added by php4hosting on Tue, 08 Oct 2019 21:38:11 +0300