javascript - How to execute this js and repeat it every 5 seconds?
黄舟
黄舟 2017-07-01 09:12:03
0
3
725
<p id="pop" style="display:none; background-color:#D1D1D1; border: 1px solid  #FF4346 ; z-index: 99999;">弹出窗口 <a href="javascript:;" onclick="javascript:document.getElementById('pop').style.display='none';">关闭</a></p>

<script>    
(function(){
    setTimeout(function(){
        var obj = document.getElementById("pop");
        obj.style.display = "block";
    },3000);
    
    function time(){
    
    
})();
</script>
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(3)
phpcn_u1582

Use setInterval instead of setTimeout

阿神

Same as above, use a periodic timer, just don’t clear the timer

大家讲道理

If you want to use setTimeout, you need to call yourself or use setInterval


function test(){
    console.log(1111)
    setTimeout(test,5000) ;
}
test()
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template