2007年2月3日星期六

定时自动刷新

过年了,同事们着急着买火车票,网上查询之,欲让结果固定时间后自动刷新,以便及时获得最新消息。

得如下代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Auto Refresh</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="闲耘">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body style="margin:0 0 0 0;">
<iframe id="piao" src="http://www.xianyun.org/" style="width:100%;height:100%;border:0px;frame-border:0px;margin-width:0px;margin-height:0px;"></iframe>

<script language="JavaScript">
<!--
var AutoRefresh = {
iframe : document.getElementById('piao'),
delay : 60*1000,
timer : null
};
AutoRefresh.refresh = function(){
this.iframe.src = this.iframe.src;
};
AutoRefresh.start = function(){
this.timer = setInterval('AutoRefresh.refresh();', this.delay);
};
AutoRefresh.stop = function(){
clearInterval(this.timer);
this.timer = null;
};

AutoRefresh.start();
//-->
</script>
</body>
</html>

没有评论:

发表评论