Home >Web Front-end >JS Tutorial >How to make timer refresh page
This article will introduce to you how to refresh the page with a timer. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Method 1: Add the setInterval() function
<script language="JavaScript"> setInterval(function(){ window.location.reload(); },3000); //每隔三秒刷新一次页面 </script>
Method 2: Automatically refresh when adding
in the tag. Content represents the refresh interval in seconds. The following code represents the page interval. Refresh once every three seconds
<meta http-equiv="refresh" content="20">
Method 3: This tag is used for timing jumps. The first parameter of content indicates the interval in seconds, and the second parameter indicates the target URL. But if the If the two parameters are set to #, the page will be refreshed.
<meta http-equiv="refresh" content="3;url=#">
Recommended learning: javascript video tutorial
The above is the detailed content of How to make timer refresh page. For more information, please follow other related articles on the PHP Chinese website!