JS在一定時間內(nèi)跳轉(zhuǎn)頁面及各種刷新頁面的實現(xiàn)方法
腳本之家整理的關(guān)于JS刷新頁面相關(guān)的總結(jié):http://www.dbjr.com.cn/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)到的目標頁面 } 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>");//open Response.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窗口
相關(guān)文章
使用 Node.js 做 Function Test實現(xiàn)方法
這篇文章介紹了Node.js 做 Function Test實現(xiàn)方法,有需要的朋友可以參考一下2013-10-10詳解CocosCreator項目結(jié)構(gòu)機制
這篇文章主要介紹了詳解CocosCreator項目結(jié)構(gòu)機制,只有了解這些機制后,才能更好的進行項目開發(fā),避免潛在錯誤,并且快速的除錯2021-04-04javascript中setAttribute()函數(shù)使用方法及兼容性
這篇文章主要介紹了javascript中setAttribute()函數(shù)使用方法及兼容性的相關(guān)資料,需要的朋友可以參考下2015-07-07Javascript中的every()與some()的區(qū)別和應(yīng)用小結(jié)
every跟some不同點在于,every要判斷數(shù)組中是否每個元素都滿足條件,只有都滿足條件才返回true,只要有一個不滿足就返回false,這篇文章主要介紹了Javascript中的every()與some()的區(qū)別和應(yīng)用,需要的朋友可以參考下2023-05-05