📄 timer.asp
字号:
<%
'---------------------------------------
'用来计算封盘倒计时
set rs=server.createobject("adodb.recordset")
sql="select tray_time,tray_switch from m_config "
rs.open sql,conn,1,1
change=0
If DateDiff("n",rs("tray_time"),Now())>=0 And DateDiff("n",rs("tray_time"),Now())<=1446 Then
Set Rs6=Conn.Execute("Update m_config Set tray_switch=0,tray_show=1,tray_show2=1,tray_show3=0")
End if
if datediff("s",rs("tray_time"),now())>1 or rs("tray_switch")=true then
response.write ""
else
'response.write rs("tray_time")
year1=year(rs("tray_time"))
month1=month(rs("tray_time"))-1
'response.write month1
day1=day(rs("tray_time"))
hour1=hour(rs("tray_time"))
minute1=minute(rs("tray_time"))
second1=second(rs("tray_time"))
%>
<span class="style1" id=show1></span> <span id="Span"></span>
<script language=javascript>
function fun()
{ var year1=<%=year1%>;
var month1=<%=month1%>;
var day1=<%=day1%>;
var hour1=<%=hour1%>;
var minute1=<%=minute1%>;
var second1=<%=second1%>;
var Date1 = new Date(year1,month1,day1,hour1,minute1,second1 );
//var Date1 = new Date(2004,06,21,16,51,12 );
var time = Date1 - new Date();//这是微秒间隔,一微秒为0.001秒,以新时间减旧时间可得出时间间隔
if (time/1000<600 )
{window.document.getElementById("show1").innerText ="即将封盘"
window.document.getElementById("Span").innerText ="倒数:"+ Math.floor(time / 1000)+"秒"; //转化为秒
//alert(time);
}
if( time ==600844)
{
alert("离封盘只有五分钟了!");
return false;
}
if (time<1000)
{
window.document.getElementById("span").innerText="";
window.document.getElementById("show1").innerText="现已封盘";
window.parent.frames. mainFrame.location.href="ac3.asp";
}
}
//fun()
setInterval("fun();",1000);//以0.2秒的间隔更新一次,理论上误差最大是199微秒,即误差不超过0.199秒,但实际上没有这么准。
</script>
<%
end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -