<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
<!--
//获得当前时间,刻度为一千分一秒
var initializationTime=(new Date()).getTime();
function showLeftTime()
{
var now=new Date();
var year=now.getYear();
var month=now.getMonth();
var day=now.getDate();
var hours=now.getHours();
var minutes=now.getMinutes();
var seconds=now.getSeconds();
document.all.show.innerHTML="当前时间:"+year+"年"+month+"月"+day+"日"+hours+"小时"+minutes+"分"+seconds+"秒";
//设定结束时间
//1秒=1000毫秒
endTime=initializationTime+60000;
//设定并显示剩余时间
var leftTime=endTime-(new Date()).getTime();
if(leftTime>0)
{
document.all.showLeft.innerHTML=leftTime+"微秒后停止!";
}
else
{
clearTimeout(timeID);
document.all.showLeft.innerHTML="TimeOut!";
return false;
}
//一秒刷新一次显示时间
var timeID=setTimeout(showLeftTime,1000);
}
//-->
</script>
</head>
<body onload="showLeftTime()">
<label id="show">这里显示开始时间</label><br>
<label id="showLeft">这里显示剩余时间</label>
</body>
</html>