Home  >  Article  >  Web Front-end  >  How to automatically refresh the web page? 3 codes for automatic page refresh

How to automatically refresh the web page? 3 codes for automatic page refresh

零下一度
零下一度Original
2018-05-16 13:31:117190browse

When you create a web page, do you sometimes want your web page to automatically refresh continuously, or automatically jump to another page you set after a period of time? In fact, it is very simple to achieve this effect, and this effect cannot even be called a special effect. You just need to add the following code to your web page.

1. Automatically refresh the page: add the following code to the 93f0f5c25f18dab9d176bd4f6de5d30e area

<meta http-equiv="refresh" content="20">,其中20指每隔20秒刷新一次页面.

2. Automatically jump the page: add the following code to the 93f0f5c25f18dab9d176bd4f6de5d30e area

<meta http-equiv="refresh" content="20;url=http://www.php.cn">,其中20指隔20秒后跳转到http://www.php.cn页面

3. The page automatically refreshes js version

<script language="JavaScript"> 
function myrefresh(){ 
window.location.reload(); 
} 
setTimeout(&#39;myrefresh()&#39;,1000); //指定1秒刷新一次 
</script>

The above is the detailed content of How to automatically refresh the web page? 3 codes for automatic page refresh. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn