自動刷新頁面的實現方法總結:
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窗口
最後要刷新A窗口
並且關閉B窗口
幾個javascript函數
//第一個自動關閉窗口
<script language="javascript">
<!--
function clock(){i=i-1
document.title="本窗口將在"+i+"秒後自動關閉!";
if(i>0)setTimeout("clock();",1000);
else self.close();}
var i=2
clock();
//-->
</script>
//第二個刷新父頁面的函數
<script language="javascript">
opener.location.reload();
</script>
//第三個打開窗口
<script language="javascript">
function show(mylink,mytitle,width,height)
{mailwin=window.open(mylink,mytitle,'top=350,left=460,width='+width+',height='+height+',scrollbars=no')}
</script>
js刷新父頁面
非模態刷新父頁面:window.opener.location.reload();
模態刷新父頁面:window.dialogArguments.location.reload();
Response.Write("<script language=\"javascript\">\r\n");
Response.Write("<!--\r\n");
Response.Write("if(dialogArguments != null){\r\n");
// 注意上面的dialogArguments,就是父頁面showModalDialog()的第二個參數。
// 就是父頁面的window對象引用。
Response.Write("dialogArguments.location.reload(true);\r\n");
// 上面就是刷新父頁的代碼,相當於在父頁上使用
// window.location.reload(true);代碼
Response.Write("window.close();}"); // 關閉對話框
Response.Write("//-->\r\n</script>"); //關閉腳本塊
}
上面的代碼就是關閉對話框和刷新父頁的代碼,這段代碼也可以直接寫入editdata.aspx的html中,然後在後臺cs中調用