胡神

导航

页面刷新方法

1.实现页面自动刷新:

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

<meta http-“refresh” content=“5”>

每隔5秒刷新

2.页面自动跳转:

<meta http-“refresh” content=“5;url=http://www.baidu.com”>

3.setTimeout

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

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

也可以用js

<script language="javascript">

function chang()

{

  document.location='http://www.baidu.com';

}

setTimeout(chang,5000);

 //setInterval(chang,5000);

//setTimeout("document.location='http://www.baidu.com'",3000);

</script>

4.按钮刷新的方法:

<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="windows.navigate(location)">

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

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

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

posted on 2011-04-11 23:14  胡神  阅读(545)  评论(0)    收藏  举报