Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个具有每 5 秒自动刷新浏览器的功能的项目。但我不知道该怎么办?我知道我必须将代码放在这样的 Setinterval 块中:
setinterval(()=>{ // auto refresh code in here }
正如您所说,settimeout 仅在您需要定义它时才起作用 simpe 脚本(仅)因此每次页面加载它都可以工作或更好地增加间隔时间由于网络问题您的页面无法正确加载您的 javascript 也没有加载
<script type="text/javascript"> setTimeout(function(){ window.location.reload(1); }, 5000); </script>