实现页面刷新的办法

1、实现页面自动刷新

把如下代码放倒<head>区域中

<meta http-equiv="refresh" content="3" />,则页面会3秒自动刷新一次。

2、页面自动跳转

<meta http-equiv="refresh" content="3;url=http://www.baidu.com" />,则页面3秒自带跳到百度页面,如果是当前页面即为自动刷新了。

3、setTimeout实现

<body onload="setTimeout('history.go(0)',3000)">//则3秒后页面自动调回到上已页面

<body onload="setTimeout('this.location.reload();',3000)">//则3秒后页面自动调回到上已页面

4、按钮刷新的N中方法

<input id="Button1" type="button" value="刷新" onclick="history.go(0)" />

<input id="Button1" type="button" value="刷新" onclick="location.reload()" />

<input id="Button1" type="button" value="刷新" onclick="location=location" />

<input id="Button1" type="button" value="刷新" onclick="location.assign(location)" />

<input id="Button1" type="button" value="刷新" onclick="document.execCommand('Refresh')" />

<input id="Button1" type="button" value="刷新" onclick="window.navigate(location)" />

<input id="Button1" type="button" value="刷新" onclick="location.replace(location)" />

<input id="Button1" type="button" value="刷新" onclick="window.open('http://www.baidu.com','_self')" />

<input id="Button1" type="button" value="刷新" onclick="document.all.WebBrowser.ExecWB(22,1)" />

posted @ 2012-11-10 11:07  Devin0613  阅读(188)  评论(0编辑  收藏  举报