日期:2014-05-16  浏览次数:20494 次

想做个网页,每天12点自动刷新一次,怎么实现
每天夜里12点 想让页面自动刷新一次,用ajax如何实现呢?

------解决方案--------------------
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page language="java" import="java.sql.*,javax.servlet.http.*"%>

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
-->
</style><head>
<title>定时提醒</title>
<script>
function doCompareTime(){
var tHour=tDate.getHours();
var tMinute=tDate.getMinutes();
var tSecond=tDate.getSeconds();
var now = (tMinute<10?"0"+tMinute:tMinute)+":"+(tMinute<10?"0"+tMinute:tMinute)+":"+(tSecond<10?"0"+tSecond:tSecond);
if(now=="00:00:00"){
window.location.href=window.location.href;
}
}
function doLoad(){
window.setInterval("doCompareTime()",1000);
}
</script>
</head>
<body onLoad="doLoad()">
</body>
</html>