倒计时计数牌HTML代码

/ 42评 / 0

每逢佳节倍思亲,这是人之常情所在。春节在中华民族有着深厚的文化基础,深入人心,铭记于每个人的心灵之上。时间的车轮不停地旋转,年复年重复着,但是,这古老的神韵披上了新的风采,让人永远无法忘怀,只要时间光临,一种激情在胸中燃烧,成为不可阻挡的力量,必须回家过年。有句歌词说的好:有钱没钱回家过年。不管你浪迹天涯海角,家这个根系在心中,成为精神依赖的港湾,回家看看也放心。这是因为家乡有自己的情感寄托,有无限的美好记忆留存在脑海中,家乡不管如何的境界,总是时刻牵挂着。有如海洋中的生物回归故里的那份执著精神,一路艰辛跋涉,不辞劳苦,就是再困难也要回家,回到生我养我的故乡。

今天错误者蓦然回首发觉新Logo旁边是否太空了呢,应该加一个春节倒计时计数牌正好利用那片空白区域。于是把度娘谷姐仔细询问了一番,功夫不负有心人,虽然没有找到调用图片或者JS那种特效倒计时计数牌,不过用表单做出来的感觉也不错,至少简单干练还可以有效不影响加载速度,在这里分享这些代码:

第一种:精确到秒的javascript倒计时代码

<form name="form1">
<div align="center" align="center">
<center>离2010年还有:<br>
<input type="textarea" name="left" size="35" 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 = 23 - NowHour
Minuteleft = 59 - NowMinute
Secondleft = 59 - NowSecond
Yearleft = 2009 - NowYear
Monthleft = 12 - NowMonth - 1
Dateleft = 31 - 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>

第二种:活动开幕倒计时

HTML代码:
<!--倒计时Javascript begin-->
<script language="JavaScript">
<!--
function DigitalTime1()
{
var deadline= new Date("08/13/2007") //开幕倒计时
var symbol="8月13日"
var now = new Date()
var diff = -480 - now.getTimezoneOffset() //是北京时间和当地时间的时间差
var leave = (deadline.getTime() - now.getTime()) + diff*60000
var day = Math.floor(leave / (1000 * 60 * 60 * 24))
var hour = Math.floor(leave / (1000*3600)) - (day * 24)
var minute = Math.floor(leave / (1000*60)) - (day * 24 *60) - (hour * 60)
var second = Math.floor(leave / (1000)) - (day * 24 *60*60) - (hour * 60 * 60) - (minute*60)

var deadline_2= new Date("08/13/2004") //开幕后计时
var symbol_2="8月13日"
var now_2 = new Date()
var diff_2 = -480 - now.getTimezoneOffset() //是北京时间和当地时间的时间差
var leave_2 = (now_2.getTime() - deadline_2.getTime()) + diff_2*60000
var day_2 = Math.floor(leave_2 / (1000 * 60 * 60 * 24))
var hour_2 = Math.floor(leave_2 / (1000*3600)) - (day_2 * 24)
var minute_2 = Math.floor(leave_2 / (1000*60)) - (day_2 * 24 *60) - (hour_2 * 60)
var second_2 = Math.floor(leave_2 / (1000)) - (day_2 * 24 *60*60) - (hour_2 * 60 * 60) - (minute_2*60)

day=day+1;
day_2=day_2+1;

if (day>0) //还未开幕
{
//LiveClock1.innerHTML = "现在"+symbol+"天"
LiveClock1.innerHTML = "<font
setTimeout("DigitalTime1()",1000)
}

if (day<0) //已经开幕
{
//LiveClock1.innerHTML = "现在离"+symbol+"还有"+day+"天"+hour+"小时"+minute+"分"+second +"秒"
LiveClock1.innerHTML = "<font
setTimeout("DigitalTime1()",1000)

}

if (day==0) //正在开幕
{
//LiveClock1.innerHTML = "现在"+symbol+"天"
LiveClock1.innerHTML = "<font
setTimeout("DigitalTime1()",1000)
}

if (day<0 & day_2>19) //某某运动会结束
{
//LiveClock1.innerHTML = "现在离"+symbol+"还有"+day+"天"+hour+"小时"+minute+"分"+second +"秒"
LiveClock1.innerHTML = "<font
setTimeout("DigitalTime1()",1000)

}

}
// -->
</script>
<!--倒计时Javascript end-->
<body onload=DigitalTime1()>
<div id= LiveClock1></div>

第三种:小时倒计时

<SCRIPT LANGUAGE="JavaScript">
<!--
var maxtime = 60*60 //一个小时,按秒计算,自己调整!
function CountDown(){
if(maxtime>=0){
minutes = Math.floor(maxtime/60);
seconds = Math.floor(maxtime%60);
msg = "距离结束还有"+minutes+"分"+seconds+"秒";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*60) alert('注意,还有5分钟!');
--maxtime;
}
else{
clearInterval(timer);
alert("时间到,结束!");
}
}
timer = setInterval("CountDown()",1000);
//-->
</SCRIPT>
<div id="timer" style="color:red"></div>

第四种:最简倒计时一

<Script Language="JavaScript">
<!-- Begin
var timedate= new Date("January 14,2006");
var times="研究生考试";
var now = new Date();
var date = timedate.getTime() - now.getTime();
var time = Math.floor(date / (1000 * 60 * 60 * 24));
if (time >= 0) ;
document.write("<li><font color=#DEDBDE>现在离2006年"+times+"还有: <font color=#ffffff><b>"+time +"</b></font> 天</font></li>");
// End -->
</Script>

第五种:最简倒计时二

<script language="JavaScript" type="text/javascript">
function djs(){
var urodz= new Date("11/12/2008");
var now = new Date();
var num
var ile = urodz.getTime() - now.getTime();
var dni = Math.floor(ile / (1000 * 60 * 60 * 24));
if (dni >1)
num=dni+1
else if (dni == 1) num=2
else if (dni == 0) num=1
else num=0
document.write(num)
}
</script>

·····························华······丽······的······分······割······线·································

countdown.js v. 1.0
The latest version is available at
http://blog.csdn.net/yjgx007

Copyright (c) 2004 Xinyi.Chen. All rights reserved.
Created 7/30/2004 by Xinyi.Chen.
Last modified: 7/30/2004

This program is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation;

See the GNU General Public License  for more details.

  1. 云飞扬说道:

    NICE啊。谢谢

  2. yihou说道:

    其实没什么重要作用的代码用多了未必会有什么好处

  3. 白开水说道:

    看你频繁的换主题 早晚会出问题的。

  4. Junan说道:

    倒数完加个烟花更有意思! 😆

  5. 青竹湾博客说道:

    这个真不错,第一次看到源代友,有空了,也整一个去

  6. 蛤蟆太阳镜说道:

    收藏下,以后一定胡会用到,谢谢分享

  7. 象牙塔说道:

    好长啊,呵呵,喜欢你的logo 😛

  8. Robin说道:

    呵呵 有意思的

发表评论

邮箱地址不会被公开。 必填项已用*标注