JS倒计时效果代码分享

JS倒计时效果代码分享
代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"></div>
<div><html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"></div>
<div><head></div>
<div><title>新建网页</title></div>
<div><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></div>
<div><meta name="description" content="" /></div>
<div><meta name="keywords" content="" /></div>
<div><script type="text/javascript"></div>
<div></div>
<div></script></div>
<div></div>
<div><style type="text/css"></div>
<div></style></div>
<div></head></div>
<div>    <body></div>
<div>    <script type="text/javascript"></div>
<div>function DigitalTime1()</div>
<div>{</div>
<div>var symbol="08/13/2013"; //开幕倒计时</div>
<div>var deadline= new Date(symbol);</div>
<div>var now = new Date();</div>
<div>var diff = -480 - now.getTimezoneOffset() //是北京时间和当地时间的时间差</div>
<div>var leave = (deadline.getTime() - now.getTime()) + diff*60000; //毫秒级别</div>
<div>var day = Math.floor(leave / (1000 * 60 * 60 * 24));</div>
<div>var hour = Math.floor(leave / (1000*3600)) - (day * 24);</div>
<div>var minute = Math.floor(leave / (1000*60)) - (day * 24 *60) - (hour * 60);</div>
<div>var second = Math.floor(leave / (1000)) - (day * 24 *60*60) - (hour * 60 * 60) - (minute*60);</div>
<div></div>
<div>LiveClock1.innerHTML = "现在离"+symbol+"还有"+day+"天"+hour+"小时"+minute+"分"+second +"秒";</div>
<div></div>
<div>setTimeout("DigitalTime1()",1000);</div>
<div>}</div>
<div>// --></div>
<div></script></div>
<div><!--倒计时Javascript end--></div>
<div><body onload=DigitalTime1()></div>
<div><div id= LiveClock1></div></div>
<div></script></div>
<div>    </body></div>
<div></html>

本文固定链接: http://www.lajiz.cn/112.html | 垃圾站

该文章由 sdujane 于2012年10月14日发表在 资源分享 分类下, 访客可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客!
原创文章,转载请注明: JS倒计时效果代码分享 | 垃圾站
关键字:

JS倒计时效果代码分享:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter