做一个登录的前端页面(仅限于个人记录)

效果如下:

 

 

 此效果运用了html,js,css

参考了前端之登录注册页面案例_前端登录注册页面_程序员班长的博客-CSDN博客​​​​s

借此来学习,真正实战

代码如下:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Document</title>

<style>

    body{

        height:100%;

        background-color:darkslategray

    }

    h1{

        text-align: center;

        color:aquamarine;

    }

    .wai{

        margin:100px auto;

        width: 30%;

    }

    form{

        background-color:aquamarine;

        height: 300px;

        width: 100%;

        border-radius: 10px;

        position: relative;

    }

    label{

        font-size: 20px;

        margin-left: 40px;

        font-weight:2px;

    }

    input{

       

        margin-left: 40px;

    }

    .submit{

        background-color: black;

        color: aliceblue;

        text-align: center;

        border-radius: 5px;

        margin-left:50%;

    }

    .left{

        position: absolute;

        left: 20px;

        }

    .right{

        position: absolute;

        right: 20px;

    }

</style>

</head>

<body>

    <div class="wai">

        <h1>用户登录</h1>

        <form>

            <label for="username">用户名</labor><br>

            <input type="text" name="username" id="username" value="" placeholder="请输入用户名">

            <br>

            <label for="password">密码</label><br>

            <input type="password" name="pass" id="pass" value="" placeholder="请输入密码">

            <div class="choose1">

                <input type="checkbox" value="" name="">

                <span>记住密码</span>

            </div>

            <div class="choose2">

                <input type="checkbox" value="" name="">

                <span>阅读并同意页面所指定的服务协议和个人信息保护政策</span>

            </div>

            <br>

            <button type="submit" class="submit" οnclick="submits(this)">登录</button>

            <br>

            <a href="index.html" class="left">回到首页</a>

            <a href="register.html" class="right">注册账号</a>

        </form>

    </div>

    <script>

        function submits(byd){

           var userName = document.getElementById("username").value;

           var pwd = document.getElementById("pass").value;

           console.log(userName)

           if (userName == "admin" && pwd == "admin") {

              alert("成功!")

           }

           else {

               alert("用户名或密码不正确!");

           }

       };

    </script>

</body>

</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值