一、Javascript有如下8种代码刷新页面的方法:
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
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
二、自动刷新页面的方法如下:
1.Javascript页面自动刷新:
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
// 每隔10秒自动刷新一次页面
setTimeout('myrefresh()',10000);
</script>
2.附:非Javascript页面自动刷新
把如下代码加入<head></head>区域中
<meta http-equiv="refresh" content="10">
即每隔10秒自动刷新一次页面.
三、ASP.NET输出Javascript刷新窗口脚本语句
1. this.response.write("<script>location.reload();</script>");
2. this.response.write("<script>window.location.href = opener.window.location.href;</script>");
3. Response.Write("<script language=javascript>window.navigate(''你要刷新的页.aspx'');</script>")