頁面定時刷新或自動跳轉


頁面定時刷新或自動跳轉


采用response對象的setHeader方法,實現頁面的定時跳轉或定時自更新。例如:

(1)response.setHeader("refresh","5");每個5s刷新一次

 (2)response.setHeader("refer","10;url=http://www.souhu.com");延遲10秒,自動重定向到網頁http://ww.souhu.com

注意:與(1)(2)等價的html代碼如下:

(3)<meta http-equiv="refresh"content="5"/>

(4)<meta http-equiv="refresh"content="10;url=http://ww.souhu.com"/>

 

頁面自動刷新js版

復制代碼 代碼如下:

function myrefresh()

{undefined

window.location.reload();

}

setTimeout('myrefresh()',1000); //指定1秒刷新一次


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM