<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        html, body, div, ul, li, h1, h2, h3, h4, h5, h6, p, dl, dt, dd, ol, form, input, textarea, th, td, select {
            margin: 0;
            padding: 0;
        }
        .change-code{
            width: 35%;
            height: 350px;
            position: absolute;
            top: 200px;
            right: 32.5%;
            border: 1px solid black;
            border-radius:10px;
            background-color: #fff;
            display: none;
        }
        .change-code .close{
            float: right;
            padding-right: 10px;
            padding-top: 10px;
            color: #3d3d3d;
            cursor: pointer;
        }
        .change-code .close:hover{
            color: #CA0C16;
        }
        .allBody{
            width: 100%;
            height: 700px;
            background-color: skyblue;
        }
    </style>
</head>
<body>
    <div id="allBody" class="allBody"><input type="button" id="change-click" value="按钮"></div>
    <div class="change-code" id="change-code">
            <p class="close" id="x">X</p>
    </div>
</body>
<script type="text/javascript">
    function $(id){return document.getElementById(id);}
    $("x").onclick = function()
        {
            $("change-code").style.display = "none";
            $("allBody").style.opacity = "1";
        }
        $("change-click").onclick = function()
        {
            $("change-code").style.display = "block";
            $("change-code").style.opacity = "1";
            $("allBody").style.disabled = false;
            $("allBody").style.opacity = "0.3";
        }
</script>
</html>

效果如图:

一个自用的弹窗demo

相关文章:

  • 2022-12-23
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2022-01-11
  • 2021-09-06
  • 2022-12-23
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2021-12-02
  • 2021-12-14
  • 2021-07-31
  • 2021-07-29
相关资源
相似解决方案