WEB頁面自動刷新的實現

方法一:html

<title>xxxxx</title>之後加入下面這一行即可!
<meta http-equiv="refresh" content="10">


10代表刷新間隔,單位爲秒,實現每隔10秒對本頁面進行一次刷新

若是要定時跳轉到其他頁面,可以用

<meta http-equiv="refresh"content="10;url=跳轉的頁面">

方法二:javascript

使用

<script language="javascript">
setTimeout("self.location.reload();",1000);
<script>

實現本頁面自動刷新,每秒一次

若是要跳轉到其他頁面,則可以使用

<script>setTimeout("location.href='url'",1000)</script>
其中url是要刷新的頁面URL地址,等待時間爲1秒
發佈了172 篇原創文章 · 獲贊 32 · 訪問量 32萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章