<%@ 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>
如果我的是ASP页面 该如何写呢
var now = (tMinute<10?"0"+tMinute:tMinute)+":"+(tMinute<10?"0"+tMinute:tMinute)+":"+(tSecond<10?"0"+tSecond:tSecond); 呵呵 这里应该是var now = (tHour<10?"0"+tHour:tHour)+":"+(tMinute<10?"0"+tMinute:tMinute)+":"+(tSecond<10?"0"+tSecond:tSecond);怪不得怎么不触发呢 谢谢2楼那位哥哥了
<%@ 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>
呵呵 这里应该是var now = (tHour<10?"0"+tHour:tHour)+":"+(tMinute<10?"0"+tMinute:tMinute)+":"+(tSecond<10?"0"+tSecond:tSecond);怪不得怎么不触发呢 谢谢2楼那位哥哥了