2012年第30届夏季伦敦奥运会开幕倒计时JS代码

      2012年第30届夏季伦敦奥运会将于北京时间2012年7月28日03时12分开幕,距离今天正好还有100天,网上邻居从网上搜索了不少倒计时代码,经过筛选,找到了一种兼容性比较好的JS代码,而且是实时显示的,也就是可以同时显示天、时、分、秒。它的效果如下:

距离2012年伦敦奥运会开幕还有:

      具体JS代码为:

<script language="JavaScript" type="text/javascript">
//<![CDATA[
var now = new Date();
function GetServerTime()
{
var urodz = new Date("7/28/2012 03:12:00");
now.setTime(now.getTime()+250);
days = (urodz - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (urodz - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (urodz - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (urodz - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
document.getElementById("date").innerHTML = daysRound;
document.getElementById("time").innerHTML = hoursRound + ":" + minutesRound + ":" + secondsRound;
}
setInterval("GetServerTime()",250);
//]]>
</script>

<strong><span style="color: #ff0000;">距离2012伦敦奥运会开幕还有:</span></strong>

<span id="date"></span><span class="white14b">天</span>

<span id="time"></span>

      另外,还找了一些JS计时代码,比如用作“本站已运行时间”还是不错的。下面给出的几个代码,都是兼容性良好的,至少用IE和Firefox测试都正常。

<script type="text/javascript">
//<![CDATA[
(function(){document.write('<font color=#555555 font-size=36px><p>本站已运行: <span id="span_dt">???天<\/font><\/span><\/p>');var BirthDay=new Date("4/27/2009 17:58:00");var msPerDay=86400000;setInterval(function(){var a=(new Date()-BirthDay)/msPerDay;var b=Math.floor(a);var c=(a-b)*24;var d=Math.floor(c);var e=(c-d)*60;var f=Math.floor(e);var g=Math.floor((e-f)*60);$("span_dt").innerHTML="<font color=#ff0000>"+b+"天"+d+"小时"+f+"分"+g+"秒"+"<\/font>"},1000);})();
//]]>
</script>

      另外两种效果如下:

本站已运行:

PS:关于Jimdo网站注册时间的一点小技巧

      在上述“本站已运行”的代码中,需要知道自己Jimdo网站的注册时间,网上邻居也没有那么好的记忆力,既能记住年、月、日,还能记住时、分、秒。这里告诉大家一个小技巧:只要到Jimdo官方论坛去发个子贴子,在贴子的右边,即会显示你的发贴数量和注册时间,比如我的,截个图片如下:

Write a comment

Comments: 11
  • #1

    淘宝600家园 (Saturday, 21 April 2012 17:45)

    网站运行这个代码比较实用~~

  • #2

    网上邻居 (Sunday, 22 April 2012 22:25)

    淘宝600家园:
    这种实用的JS代码,网络上还是很多的,只是考虑它的兼容性问题,需要花一点时间进行测试。

  • #3

    网型网秀 (Sunday, 22 April 2012 22:51)

    论坛上的注册时间不是注册网站的时间,它记录的是你登录论坛时的日期,比如我的论坛上的时间是2010年2月23日,实际上我在2009年就注册了此域名的,只是一直没有使用。

  • #4

    网上邻居 (Sunday, 22 April 2012 22:57)

    哈哈,晕...我一直是这么认为的。我看论坛的下方,一直显示最新注册的用户,找时间问下客服。

  • #5

    www (Wednesday, 25 April 2012 16:58)

    用一下试试

  • #6

    淘宝600家园 (Tuesday, 08 May 2012 11:00)

    如果你建站的时间和在论坛上注册的时间差不多的话,也没所谓了~~`

  • #7

    网上邻居 (Tuesday, 08 May 2012 12:23)

    关于建站时间,请教了一下客服,他们是可以查的,作为Jimdo站长,最简单的方法就是查看一下当时Jimdo发来的注册邮件,如果邮件未保存,那只能在客服不忙的时候,请教他们了。

  • #8

    Burberry Outlet Online (Friday, 27 July 2012 05:57)

    Thank you for your useful information.

  • #9

    Coach Purses Outlet (Wednesday, 24 April 2013 03:00)

    Lsx The Coach Outlet Store left many of the best materials, often in one-size-color style, size and height provide great value.There, so that some of Coach Factory Online the design and style handbags are more great than.The of comfort and style Coach Bags Outlet can start learning to do the same thing about this brand handbags women demand their fashion concept.

  • #10

    wlp (Friday, 03 July 2015 12:28)

    http://www.burberry-outlet.jp.net/
    http://www.burberryoutlet.org.uk/
    http://www.burberryoutlet-online.co.com/
    http://www.burberryoutlet-online.in.net/
    http://www.calvinklein.co.com/
    http://www.celinebags.org/
    http://www.chanelhandbags.net.co/
    http://www.cheapbaseballbats.net/
    http://www.christianlouboutinshoes.ar.com/
    http://www.air-huarache.co.uk/
    http://www.airjordans.us/
    http://www.airjordanshoes2015.com/
    http://www.airmax-2015.org/
    http://www.airmax-90.org/
    http://www.babyliss-pro.net/
    http://www.basketballshoes.com.co/
    http://www.beatsbydrdre.co.com/
    http://www.beatsbydre.com.co/
    http://www.beats-by-dre.com.co/
    http://www.beatsheadphones.in.net/
    http://www.bottega.us/
    http://www.burberryhandbags.net.co/
    http://www.cheapjerseys.in.net/
    http://www.cheap-jordans.net/
    http://www.cheapmichaelkors.us.org/
    http://www.cheap-nikeshoes.com/
    http://www.cheapoakley.us.org/
    http://www.cheapoakleysunglasses.ar.com/
    http://www.cheap-oakleysunglasses.in.net/
    http://www.cheaprayban.com.co/
    http://www.cheapshoes.com.co/
    http://www.cheapuggboots.eu.com/
    http://www.chiflatiron.net.co/
    http://www.christian--louboutin.in.net/
    http://www.christianlouboutin.org.uk/
    http://www.christianlouboutinshoes.jp.net/
    http://burberry.outletnow.net/
    http://christian.louboutin-outlet.net/
    http://toryburch.salesandals.net/
    http://www.abercrombieand-fitch.com.co/
    http://www.abercrombiefitch.us.com/
    http://www.abercrombie-kids.us.com/
    http://www.coachfactory-outlet.co.com/
    http://www.coachfactoryoutletonline.co.com/
    http://www.coach-handbags.com.co/
    http://www.coachoutlet-online.com.co/
    http://www.coachoutletstore.net.co/
    http://www.coachoutletstore-online.com.co/
    http://www.coco-chanelbags.com.co/
    http://www.converse.net.co/
    http://www.designerhandbagsoutlet.com.co/
    http://www.eyeglassesonline.us.com/
    http://www.eyeglassframes.us.com/
    http://www.fashion-clothing.us.com/
    http://www.ferragamo.com.co/
    http://www.ferragamoshoes.net/
    http://www.ghdhairstraightener.com.co/
    http://www.jimmychoo.net.co/
    http://www.jordanretro.org/
    http://www.jordan-shoes.com.co/
    http://www.juicycouture.com.co/
    http://www.juicycoutureoutlet.net.co/
    http://www.louisvuitton-outlet.com.co/
    http://www.louisvuitton-outlets.us/
    http://www.marcjacobsonsale.com/
    http://www.mcm-bags.net/
    http://www.mcmhandbags.com.co/
    http://www.michaelkors.so/
    http://www.michael--kors.us.com/
    http://www.michaelkorsbags.us.org/
    http://www.michaelkorshandbags.org.uk/
    http://www.michael-kors-handbags.us.com/
    http://www.michaelkorsoutlet.ar.com/
    http://www.michael-kors-outlet.us.org/
    http://www.michaelkorsoutlet-online.ar.com/
    http://www.michael-kors-outlet-online.us.org/
    http://www.michaelkorsoutletonline-sale.us.com/
    http://www.michaelkors-uk.org.uk/
    http://www.montblanc--pens.net/
    http://www.newbalance-outlet.org/
    http://www.nike-air-max.us/
    http://www.nikefactory.org/
    http://www.nikefree5.net/
    http://www.nikefree-run.net/
    http://www.nikefree-run.org.uk/
    http://www.jordanrelease-dates.com/
    http://www.nikemercurial.net/
    http://www.nikerosherun.us/
    http://www.nikestore.us/
    http://www.northface.us.org/
    http://www.northfaceoutlet.com.co/
    http://www.oakleyoutlet.us.org/
    http://www.oakley-sunglasses.us.org/
    http://www.oakleysunglassescheap.in.net/
    http://www.oakleysunglassesoutlet.com.co/
    http://www.omegawatches.us.com/
    http://www.pandora-charms.org.uk/
    http://www.pandorajewelry.com.co/
    http://www.polo-outlets.com/
    http://www.pradahandbags.net.co/
    http://www.pradahandbags.com.co/
    http://www.pradashoes.com.co/
    http://www.ralph-lauren.org.uk/
    http://www.ralphlaurenoutlet.us.com/
    http://www.ralphlauren-outlet.org.uk/
    http://www.ralphlaurenoutletonline.com.co/
    http://www.ralphlaurenoutletonline.in.net/
    http://www.gucci.me.uk/

  • #11

    designer italian handbags (Saturday, 19 August 2017 15:42)

    This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff.