刷新页面的方法

1.实现页面自动刷新

把如下加入到<head>区域中:

<meta http-equiv = "refresh" content = "5">

其中"5"指每隔5秒刷新一次页面。

2.页面自动跳转

<meta http-equiv = "refresh" content = "5;url = " _mce_href="http://www.maticsoft.com">">http://www.maticsoft.com">

指隔5秒后跳转到http://Maticsoft.com页面,如果是当前页面即为自动刷新了。

3.setTimeout实现

<body onload = "setTimeout('history.go()',5000)">

<body onload = "setTimeout('this.location.reload();',5000)">

也可以通过脚本实现:

<script type = "text/javascript" language = "javascript">
     function chang()
{
 document.location = 'http://www.maticsoft.com';
}
setTimeout(chang,5000);//定时执行
//setInterval(chang,5000); //间隔执行
//setTimeout("document.location = 'http://www.maticsoft.com' ",3000)
</script>

4.按钮刷新的N种方法

<input type = button value = 刷新 onclick = "history.go(0)">
<input type = button value = 刷新 onclick = "location.reload()">
<input type = button value = 刷新 onclick = "location = location">
<input type = button value = 刷新 onclick = "location.assign(location)">
<input type = button value = 刷新 onclick = "document.execCommand('Refresh')">
<input type = button value = 刷新 onclick = "window.navigate(location)">
<input type = button value = 刷新 onclick = "location.replace(location)">
<input type = button value = 刷新 onclick = "window.open('http://www.maticsoft.com','_self')">
<input type = button value = 刷新 onclick = "document.all.WebBrowser.ExecWB(22,1)">

posted on 2011-03-14 15:01  云起的自学笔记  阅读(379)  评论(0编辑  收藏  举报

导航