定时自动刷新本页面
例如,每20秒刷新本页面,把下面代码加入到head块
<meta http-equiv="refresh" content="20">
到时自动调整到指定页面
例如,20秒后调转到www.xxx.xxx页面,把下面代码加入到head块
<meta http-equiv="refresh" content="20;url=http://www.xxx.xxx">
页面自动刷新js版
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
框架页面中,刷新指定窗口,用javascript
parent.location.reload(); //子窗口刷新父窗口
self.opener.location.reload(); //子窗口刷新打开该子窗口的窗口
parent.otherFrameID.location.reload(); //自窗口刷新兄弟窗口
top.location.reload(); //子窗口刷新顶级窗口(或根窗口)
打开或关闭页面时刷新 //未测试
<body οnlοad="opener.location.reload()"> 打开页面时刷新
<body onUnload="opener.location.reload()"> 关闭页面时刷新
<script language="javascript"> 打开页面时刷新
window.opener.document.location.reload()
</script>
ASP.NET如何输出刷新父窗口脚本语句 //未测试
1. this.response.write("<script>opener.location.reload();</script>");
2. this.response.write("<script>opener.window.location.href = opener.window.location.href;</script>");
3. Response.Write("<script language=javascript>opener.window.navigate(''你要刷新的页.asp'');</script>")
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
JavaScript Refresh Button
<html>
<head>
<title>Refresh Button Example</title>
<script language="JavaScript">
<!--
// The "refresh" function implementations are identical
// to our regular "JavaScript-Refresh" example. The only
// difference from our JavaScript Refresh example is
// we do not have a doLoad function that starts our
// refresh timer (since we use a refresh button).
var sURL = unescape(window.location.pathname);
function refresh()
{
window.location.href = sURL;
}
//-->
</script>
<script language="JavaScript1.1">
<!--
function refresh()
{
window.location.replace( sURL );
}
//-->
</script>
<script language="JavaScript1.2">
<!--
function refresh()
{
window.location.reload( false );
}
//-->
</script>
</head>
<body>
<script language="JavaScript">
<!--
// we put this here so we can see something change
document.write('<b>' + (new Date).toLocaleString() + '</b>');
//-->
</script>
<!--
In every example that we use below, we simply call the "refresh"
JavaScript function.
Our first example uses a "link" that invokes the JavaScript function.
-->
<p><a href="javascript:refresh()">Refresh Link</a></p>
<!--
The "image" button is nothing more than an image nested in a link.
-->
<p><a href="javascript:refresh()"><img src="images/button_green.gif" border="0"
align="middle" width="71" height="70"></a>image as a button</p>
<!--
The last method ties into the "onclick" event for a form button.
-->
<form method="GET" action="refreshbutton.htm">
<p><input type="button" οnclick="refresh()" value="Refresh Form Button"
name="button1"></p>
</form>
</body>
</html>