会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132358个问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
        }
        
        .zz {
            height: 100%;
            width: 100%;
            display: none;
            position: absolute;
            left: 0;
            top: 0;
            background-color: rgba(0, 0, 0, 0.6);
        }
        
        .box {
            height: 290px;
            width: 700px;
            position: absolute;
            left: 50%;
            display: none;
            top: 50%;
            margin-left: -350px;
            margin-top: -145px;
            box-sizing: border-box;
            background-color: #fff;
        }
        
        .box .move {
            height: 22px;
            width: 100%;
            position: absolute;
            top: 0;
            left: 0;
            cursor: move;
        }
        
        .box h2 {
            height: 56px;
            line-height: 56px;
            text-align: center;
            font-weight: normal;
            font-size: 28px;
        }
        
        table {
            height: 88px;
            width: 480px;
            margin: 10px auto;
            border-collapse: collapse;
        }
        
        tr,
        td {
            font-size: 20px;
        }
        
        table tr td:nth-child(1) {
            text-align: right;
        }
        
        input {
            height: 32px;
            width: 290px;
            padding-left: 5px;
            border: 1px solid #ccc;
        }
        
        p {
            margin-top: 30px;
            text-align: center;
        }
        
        button {
            width: 200px;
            height: 38px;
            background-color: skyblue;
            border: none;
            cursor: pointer;
        }
        
        .close {
            height: 34px;
            width: 34px;
            line-height: 34px;
            text-align: center;
            font-size: 28px;
            border-radius: 50%;
            position: absolute;
            right: -16px;
            top: -16px;
            cursor: pointer;
            border: 1px solid #aaa;
            background-color: #fff;
        }
    </style>
</head>
<body>
    <p class="begin">点我登陆咯!!</p>
    <div class="zz"></div>
    <div class="box">
        <div class="move"></div>
        <h2>登录会员</h2>
        <table>
            <tr>
                <td>用户名:</td>
                <td><input type="text" placeholder="请输入手机号"></td>
            </tr>
            <tr>
                <td>登录密码:</td>
                <td><input type="password" placeholder="请输入密码"></td>
            </tr>
        </table>
        <p><button>登录</button></p>
        <div class="close">×</div>
    </div>
</body>
<script>
    var zz = document.querySelector('.zz');
    var box = document.querySelector('.box');
    var begin = document.querySelector('.begin');
    var close = document.querySelector('.close');
    var move = document.querySelector('.move');
    begin.onclick = function() {
        zz.style.display = "block";
        box.style.display = "block";
    }
    close.addEventListener('click', function() {
        zz.style.display = "none";
        box.style.display = "none";
    });
    move.addEventListener('mousedown', function(e) {
        var x = e.pageX - box.offsetLeft;
        var y = e.pageY - box.offsetTop;
        document.addEventListener('mousemove', move);
        function move(e) {
            box.style.left = e.pageX - x + "px";
            box.style.top = e.pageY - y + "px";
        }
        document.addEventListener('mouseup', function() {
            document.removeEventListener('mousemove', move);
        });
    });
</script>
</html>


老师,我不知道为什么,拖动元素一直计算错误。您帮我瞅瞅。谢谢

WEB前端全系列/第二阶段:JavaScript编程模块/浏览器模型(BOM) 168楼

Desktop.zip

老师,我花了一个小时写了一个模仿技能释放的,能帮我看看有没有什么没有考虑到的吗。

WEB前端全系列/第二阶段:JavaScript编程模块/DOM模型 170楼
WEB前端全系列/第二阶段:JavaScript编程模块/DOM模型 172楼
WEB前端全系列/第二阶段:JavaScript编程模块/Math与Date 173楼
WEB前端全系列/第二阶段:JavaScript编程模块/浏览器模型(BOM) 178楼
WEB前端全系列/第二阶段:JavaScript编程模块/JavaScript基础与变量 179楼

老师,我下载的

Doc1.docx

插件没有用是怎么回事啊

WEB前端全系列/第二阶段:JavaScript编程模块/算法与数据 180楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637