美文网首页
11.30setTimeout

11.30setTimeout

作者: overisover | 来源:发表于2016-12-02 09:05 被阅读0次

setTimeout

setTimeout(function(){},1000)//隔一秒后执行函数;类似闹钟;
广告弹出效果:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
    div{
        width:400px;
        height:400px;background:#fbb;
        position:fixed;
        right:0px;
        bottom:0px;
        display:none;
    }
    </style>
    
</head>
<body>
    <div></div>
    <script>
        var oDiv=document.getElementsByTagName('div')[0];
        setTimeout(function(){
            oDiv.style.display='block';
            setTimeout(function(){
                oDiv.style.display='none';
            },5000)
        },2000);

    </script>
</body>
</html>

相关文章

  • 11.30setTimeout

    setTimeout setTimeout(function(){},1000)//隔一秒后执行函数;类似闹钟;广...

网友评论

      本文标题:11.30setTimeout

      本文链接:https://www.haomeiwen.com/subject/vjozpttx.html