js在一定時間內跳轉頁面及各種頁面刷新


1.js 代碼:

<SCRIPT LANGUAGE="JavaScript">

var time = 5; //時間,秒

 

var timelong = 0;

 

function diplaytime(){ //時間遞減

document.all.his.innerHTML = time -timelong ;

timelong ++;

}

 

 

function redirect(){ //跳轉頁

//history.back();

window.location.href="Category-list";//指定要跳轉到的目標頁面

 

}

 

timer=setInterval('diplaytime()', 1000);//顯示時間

timer=setTimeout('redirect()',time * 1000); //跳轉

</SCRIPT>

 

-----------------------------------------------------------------

2.頁面引用:

<DIV ALIGN="CENTER" style="font-size:15;color:threeddarkshadow;" >

如果你不執行任何操作,系統會在5秒后自動返回!

</DIV>

<DIV ALIGN="CENTER" style="font-size:15;color:threeddarkshadow;" id="his">

5秒鍾后自動返回.....

</DIV>

 

 

javascript/js 自動刷新頁面和頁面跳轉的實現方法

1)
<meta http-equiv="refresh"content="10;url=跳轉的頁面">
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>")

轉到指定頁:
Response.Write("<script language=javascript>window.location.href='yourpage.aspx';</script>")

 

刷新頁面實現方式總結(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參數或者表單傳值判斷是否發生某個操作,然后利用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"/>

 

刷新的內容加在 if (!IsPostBack)

 

 

在框架頁中右面刷新左面
//刷新框架頁左半部分
Response.Write("<script language=javascript>");
Response.Write("parent.left.location.href='PayDetailManage_Left.aspx'");
Response.Write("</script>");

 


頁面定時刷新功能實現

 

有三種方法:
1,在html中設置:
<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>
一秒一次

 


頁面自動跳轉:
1,在html中設置:
<title>xxxxx</title>之後加入下面這一行即可!
定時跳轉並刷新:<meta http-equiv="refresh" content="20;url=http://自己的URL">,
其中20指隔20秒后跳轉到http://自己的URL

 頁面。

 


點擊按鈕提交表單后刷新上級窗口

 

A窗口打開B窗口

 

然后在B里面提交數據至C窗口

 

 

 


免責聲明!

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



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