<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>研究生考试时间</title>
<script language="javascript" type="text/javascript">
function checkTime(i)
{
if(i<10)
{
i="0"+i;
}
return i;
}
var time = setInterval('showTime()',500);
function showTime()
{
var timedate= new Date("2016/10/01,10:13:55"); //自定义结束时间
var now = new Date(); //获取当前时间
var date = parseInt(timedate.getTime() - now.getTime())/1000; //得出的为秒数;
if(date <= 0)
{
document.getElementById("txtshow").innerHTML="倒计时已经结束";
clearInterval(time);
}
var day = parseInt(date/60/60/24);
var hour = parseInt(date/60/60%24);
var minute = parseInt(date/60%60);
var second = parseInt(date%60);
hour = checkTime(hour);
minute = checkTime(minute);
second = checkTime(second);
var leftTime = day+"天"+hour+"时"+minute+"分"+second+"秒";
document.getElementById('timeShow').innerHTML = leftTime;
time;
}
</script>
</head>
<body>
<div class="content2">
<div id="txtshow">距离设置时间还有 <b id="timeShow"></b> </div>
</div>
</body>
</html>
效果图:
热门评论
什么都没有,默默的想问一句远行过没有?