ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Pink老师JS学习--京东登录页面案例

2021-03-19 19:00:49  阅读:151  来源: 互联网

标签:Pink eye width -- JS color position font border


 感谢pink老师的课程。

这是我自己写的样式,比较丑。

这个案例是主要是练习巩固操作元素,实现了密码隐藏显示的功能。

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .sign {
            width: 600px;
            margin: 100px auto;
        }

        h1 {
            font-size: 28px;
            font-weight: 400;
            padding-bottom: 30px;
            text-align: center;
            color: rgb(245, 100, 100);
        }


        .box,
        .user {
            position: relative;
            color: rgb(66, 66, 66);
            width: 100%;
            border-bottom: 1px solid rgb(228, 228, 228);
        }

        .user input {
            width: 100%;
            height: 40px;
            font-size: 20px;
            border: 0;
        }

        #pwd {
            width: 460px;
            height: 46px;
            font-size: 20px;
            border: 0;

        }

        #eye {
            position: absolute;
            top: 11px;
            right: 80px;
            width: 24px;

        }

        .box label {
            position: absolute;
            right: 10px;
            color: #cdcdcd;
            font-size: 14px;
            line-height: 46px;
        }

        .bt {
            width: 500px;
            height: 32px;
            margin-left: 50px;
            margin-top: 28px;
            border: 0;
            border-radius: 16px;
            background-color: rgb(255, 60, 0);
            color: white;
        }

        .bt:hover {
            outline: none;
        }

        input:focus {
            outline: none;
        }

        .rem {
            position: relative;
        }

        .rem label,
        span {
            color: gray;
            font-size: 14px;
        }

        .rem label {
            position: absolute;
            left: 50px;
            top: 10px;

        }

        .rem span {
            position: absolute;
            top: 10px;
            right: 50px;
        }
    </style>
</head>

<body>
    <div class="sign">
        <h1>会员登录</h1>
        <!--输入用户名-->
        <div class="user">
            <input type="text">
        </div>
        <!--输入密码-->
        <div class="box">
            <input type="password" id="pwd">
            <img src="隐藏.png" alt="" id="eye">
            <label for="">| 忘记密码</label>
        </div>
        <!--登录按钮-->
        <button class="bt">登录</button>
        <!--信息提示-->
        <div class="rem">
            <label>短信验证码登录</label>
            <span>手机快速注册</span>
        </div>
    </div>
</body>
<script>
    /*获取对象*/
    var eye = document.getElementById('eye');
    var pwd = document.getElementById('pwd');
    //注册事件
    var flag = 0;
    eye.onclick = function () {
        if (flag = 0) {    //这里不能用=号,要用==号
            pwd.type = 'password';
            eye.src = '隐藏.png';
            flag = 1;
        } else {
         
            pwd.type = 'text';
            eye.src = '显示 (1).png';
            flag = 0;
        }

    }

</script>

</html>

 

标签:Pink,eye,width,--,JS,color,position,font,border
来源: https://blog.csdn.net/YuKing_HONG/article/details/115013475

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有