刷新页面有一下几种:
1、直接在页面上: 每两秒刷新页面
<meta http-equiv="refresh" content="2">
2、每秒刷新页面
1 setTimeout('myrefresh()',1000);
2 function myrefresh() {
3 window.location.reload();
4 }
3、每整点刷新一次
1 setInterval("flash()",1000);
2 function flash(){
3 var now=new Date();
4 var s=now.getSeconds();
5 var m=now.getMinutes();
6 if(m=="0"&& s=="0"){
7 window.location.reload();
8 }
9 };
4、每两小时刷新一次页面
1 setInterval("flash2Hour()", 1000);
2 function flash2Hour(){
3 var now=new Date();
4 var h=now.getHours();
5 var m=now.getMinutes();
6 var s=now.getSeconds();
7 var arr=["0","2","4","6","8","10","12","14","16","18","20","22"];
8 for(var i=0;i<arr.length;i++){
9 if(h==arr[i]){
10 if(m=='0'&& s=='0'){
11 window.location.reload();
12 }
13 }
14 }
15 };