IMG_20170831_080709.jpg

之前博主搭建了一个个人单页网站,然后觉得太单调了,所以就想着加点东西上去,既然博主也在读高中为何不加上一个高考倒计时上去呢,然后翻阅各种网站,最后找到了下面的代码

<form name="form1">
<div align="center" align="center">
<center>距离2019年高考还有:<br>
<input type="textarea" name="left" size="37" style="text-align: center">
</center>
</div>
</form>
<script LANGUAGE="javascript">
startclock()
var timerID = null;
var timerRunning = false;
function showtime() {
Today = new Date();
var NowHour = Today.getHours();
var NowMinute = Today.getMinutes();
var NowMonth = Today.getMonth();
var NowDate = Today.getDate();
var NowYear = Today.getYear();
var NowSecond = Today.getSeconds();
if (NowYear <2000)
NowYear=1900+NowYear;
Today = null;
Hourleft = 09 - NowHour
Minuteleft = 00 - NowMinute
Secondleft = 00 - NowSecond
Yearleft = 2019 - NowYear
Monthleft = 06 - NowMonth - 1
Dateleft = 07 - NowDate
if (Secondleft<0)
{
Secondleft=60+Secondleft;
Minuteleft=Minuteleft-1;
}
if (Minuteleft<0)
{
Minuteleft=60+Minuteleft;
Hourleft=Hourleft-1;
}
if (Hourleft<0)
{
Hourleft=24+Hourleft;
Dateleft=Dateleft-1;
}
if (Dateleft<0)
{
Dateleft=31+Dateleft;
Monthleft=Monthleft-1;
}
if (Monthleft<0)
{
Monthleft=12+Monthleft;
Yearleft=Yearleft-1;
}
Temp=Yearleft+'年, '+Monthleft+'月, '+Dateleft+'天, '+Hourleft+'小时, '+Minuteleft+'分, '+Secondleft+'秒'
document.form1.left.value=Temp;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
var timerID = null;
var timerRunning = false;
function stopclock () {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
stopclock();
showtime();
}
// -->
</script>


本文最后更新于2017-9-1,已超过一个月没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
[百度未收录] | [360已收录] | [搜狗已收录]