【www.bbyears.com--js教程】
定时刷新:
1,利用setTimeout
代码如下<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout("myrefresh()",1000); //指定1秒刷新一次
</script>
说明:url是要刷新的页面URL地址
2000是等待时间=2秒,
2,利用meta中的Refresh刷新
代码如下< 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地址
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