武林網(wǎng)整理的關(guān)于JS刷新頁面相關(guān)的總結(jié)://m.survivalescaperooms.com/article/139788.htm
1.js 代碼:
<SCRIPT LANGUAGE="JavaScript">var time = 5; //時間,秒var timelong = 0;function diplaytime(){ //時間遞減document.all.his.innerHTML = time -timelong ;timelong ++;}function redirect(){ //跳轉(zhuǎn)頁//history.back();window.location.href="Category-list";//指定要跳轉(zhuǎn)到的目標(biāo)頁面}timer=setInterval('diplaytime()', 1000);//顯示時間timer=setTimeout('redirect()',time * 1000); //跳轉(zhuǎn)</SCRIPT>2.頁面引用:
<DIV ALIGN="CENTER" style="font-size:15;color:threeddarkshadow;" >如果你不執(zhí)行任何操作,系統(tǒng)會在5秒后自動返回!</DIV><DIV ALIGN="CENTER" style="font-size:15;color:threeddarkshadow;" id="his">5秒鐘后自動返回.....</DIV>
javascript/js 自動刷新頁面和頁面跳轉(zhuǎn)的實現(xiàn)方法
1)
<meta http-equiv="refresh"content="10;url=跳轉(zhuǎn)的頁面">
10表示間隔10秒刷新一次
2)
<script language=''javascript''>window.location.reload(true);</script>
如果是你要刷新某一個iframe就把window給換成frame的名字或ID號
3)
<script language=''javascript''>window.navigate("本頁面url");</script>4>
function abc(){window.location.href="/blog/window.location.href";setTimeout("abc()",10000);}刷新本頁:
Response.Write("<script language=javascript>window.location.href=window.location.href;</script>")刷新父頁:
Response.Write("<script language=javascript>opener.location.href=opener.location.href;</script>")轉(zhuǎn)到指定頁:
Response.Write("<script language=javascript>window.location.href='yourpage.aspx';</script>")刷新頁面實現(xiàn)方式總結(jié)(HTML,ASP,JS)'by aloxy
定時刷新:
1,
<script>setTimeout("location.href='url'",2000)</script>說明:url是要刷新的頁面URL地址
2000是等待時間=2秒,
2,<meta name="Refresh" content="n;url">
說明:
n is the number of seconds to wait before loading the specified URL.
url is an absolute URL to be loaded.
n,是等待的時間,以秒為單位
url是要刷新的頁面URL地址
3,<%response.redirect url%>
說明:一般用一個url參數(shù)或者表單傳值判斷是否發(fā)生某個操作,然后利用response.redirect刷新。
4,刷新框架頁
〈script language=javascript>top.leftFrm.location.reload();parent.frmTop.location.reload();</script〉
彈出窗體后再刷新的問題
Response.Write("<script>window.showModalDialog('../OA/SPCL.aspx',window,'dialogHeight: 300px; dialogWidth: 427px; dialogTop: 200px; dialogLeft: 133px')</script>");//openResponse.Write("<script>document.location=document.location;</script>");在子窗體頁面代碼head中加入<base target="_self"/>
刷新的內(nèi)容加在 if (!IsPostBack)中在框架頁中右面刷新左面
//刷新框架頁左半部分Response.Write("<script language=javascript>");Response.Write("parent.left.location.href='PayDetailManage_Left.aspx'");Response.Write("</script>");頁面定時刷新功能實現(xiàn)
有三種方法:
1,在html中設(shè)置:
<title>xxxxx</title>之後加入下面這一行即可!
定時刷新:<META HTTP-EQUIV="Refresh" content="10">
10代表刷新間隔,單位為秒
2.jsp
<% response.setHeader("refresh","1"); %>
每一秒刷新一次
3.使用javascript.:
<script language="javascript">setTimeout("self.location.reload();",1000);<script>一秒一次
頁面自動跳轉(zhuǎn):
1,在html中設(shè)置:
<title>xxxxx</title>之後加入下面這一行即可!
定時跳轉(zhuǎn)并刷新:<meta http-equiv="refresh" content="20;url=http://自己的URL">,其中20指隔20秒后跳轉(zhuǎn)到http://自己的URL
頁面。
點擊按鈕提交表單后刷新上級窗口
A窗口打開B窗口
然后在B里面提交數(shù)據(jù)至C窗口
新聞熱點
疑難解答