web前端 - 模态对话框

代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        .beijing {
            display: none;
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 1040;
            background-color: #000000;
            opacity: 0.8;
        }

        .registered{
            float: left;
            margin-top: 50px;
            margin-left: 400px;
            height: 100px;
            width: 300px;
            padding-top: 20px;
            padding-left: 10px;
            background-color: white;
        }

    </style>

</head>
<body>

    <div>
        <input type="button" value="登录" onclick="show()" />
        <div ID="bj" class="beijing">
            <div class="registered">

                username: <input type="text" /><br/>
                password: <input type="password" />

            </div>

        </div>

    </div>


    <script>

        function show() {
            obj = document.getElementById('bj');
            obj.style.display = "block"


        }
    </script>

</body>
</html>

效果图

posted on 2016-08-20 11:47  奋斗中的码农  阅读(812)  评论(0编辑  收藏  举报

导航