setTimeout:pop a window

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        window.onload = function () {
            var oPop = document.getElementById('pop');
            //set the time to pop the window
            setTimeout(showpop,4000);
            function showpop() {
                oPop.style.display = 'block';
            }
        }
    </script>
    <style>
        .pop_con{
            display: none;
        }
        .pop{
            width: 400px;
            height: 300px;
            background-color: white;
            border: 1px solid black;
            //make the hint window align center in the window
            position: fixed;
            left: 50%;
            top:50%;
            margin-left: -200px;
            margin-top: -150px;
            //make the hint window place front of the mask window
            z-index: 9999;
        }
        .mask{
        //make the window filled with the mask window
            position: fixed;
            width: 100%;
            height: 100%;
            background-color: black;
            left: 0;
            top: 0;

            opacity: 0.3;
            //make it compatible with IE browser
            filter: alpha(opacity=30);
            z-index: -9999;
        }
    </style>
</head>
<body>

    <h1>Home Page</h1>
    <p>page Content</p>

    <div class="pop_con" id="pop">
        <div class="pop">
            <h3>hint!</h3>
        </div>
        <div class="mask"></div>
    </div>

</body>
</html>

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值