一只甜甜圈
2018-05-16 17:52:44浏览 1892
<script type="text/javascript">
var StartTime = new Date("2008/06/15 12:34:03");
document.write("订购时间: " + StartTime.toLocaleDateString() + StartTime.toLocaleTimeString() + "<br/>");
var CurrentTime = new Date();
document.write("当前时间: " + CurrentTime.toLocaleDateString() + CurrentTime.toLocaleTimeString() + "<br/>");
var EndTime=StartTime.getTime() + 15*24*60*60*1000;//约定订购时间15天后关闭交易
EndTime = new Date(EndTime);
document.write("结束时间: " + EndTime.toLocaleDateString() + EndTime.toLocaleTimeString() + "<br/>");
var TempTime = StartTime;
var nMS,nD,nH,nM,nS;
function ShowCloseTime(){
var oDate = new Date();
nMS=EndTime-oDate ;
nD=Math.floor(nMS/(1000*60*60*24));
nH=Math.floor(nMS/(1000*60*60)) % 24 ;
nM=Math.floor(nMS/(1000*60)) % 60;
nS=Math.floor(nMS/1000) % 60;
document.getElementById("CloseTime").innerHTML = ("您还有" + nD + "天" + nH + "小时" + nM + "分" + nS + "秒完成交易");
if (nS<0 || nM<0 || nH<0 || nD<0)
{
document.getElementById("CloseTime").innerHTML = "交易因超过15天,已被系统自动关闭"
clearInterval(CloseTimer);
}
}
var CloseTimer = window.setInterval("ShowCloseTime()",1000)
</script>
<div id="CloseTime"></div>