javascript interval

后端 未结 3 550
梦谈多话
梦谈多话 2020-11-30 14:13

How can I use interval in js? For example I want to call a function every 5 seconds?



        
3条回答
  •  执念已碎
    2020-11-30 14:58

    These answers are thorough and good; I just want to specifically fix yours. See the other answers for HOW/WHY.

    setInterval(openAPage, 5000);
    

    Note the lack of ().

    Also, you're missing the closing } on the openAPage() function.

提交回复
热议问题