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

零下一度
Release: 2018-05-16 13:31:11
Original
7192 people have browsed it

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 area

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

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

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

3. The page automatically refreshes js version

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template