当前位置:首页 > 网页设计 > 网页特效 > 时间日期特效 > 详细内容
四国首都显示当前时间
发布时间:2009-8-20  阅读次数:3657  字体大小: 【】 【】【

代码如下:

<!--<div class="head_time">北京:<span id="beijing"></span> 伦敦:<span id="lundun"></span> 纽约:<span id="niuyue"></span> 东京:<span id="dongjing"></span></div>-->
    <div   align="right">北京:<span id="beijing"></span> 伦敦:<span id="lundun"></span> 纽约:<span id="niuyue"></span> 东京:<span id="dongjing"></span>&nbsp;&nbsp;</div>
    <script language="JavaScript">
    var now,hours,minutes,seconds,timeValue;
    function showtime(){
      now = new Date();
      hours = now.getHours();
      minutes = now.getMinutes();
      seconds = now.getSeconds();
      //北京
      timeValue = "";
      timeValue += ((hours <10 ) ? "0": "")+ hours + ":";
      timeValue += ((minutes < 10) ? "0" : "") + minutes + ":";
      timeValue += ((seconds < 10) ? "0" : "") + seconds;
      //alert(timeValue);
      document.getElementById(beijing).innerHTML = timeValue;
      //伦敦
      timeValuelundun = "";
      if((hours-7)<0)
      {
        hourslundun=24-(7-hours);
      }
      else
      {
        hourslundun=hours-7;
      }
      timeValuelundun += ((hourslundun <10 ) ? "0": "")+ hourslundun + ":";
      timeValuelundun += ((minutes < 10) ? "0" : "") + minutes + ":";
      timeValuelundun += ((seconds < 10) ? "0" : "") + seconds;
      document.getElementById(lundun).innerHTML = timeValuelundun;
      
      timeValueniuyue = "";
      if((hours-13)<0)
      {
        hoursnouyue=24-(12-hours);
      }
      else
      {
        hoursnouyue=hours-12;
      }
      timeValueniuyue += ((hoursnouyue <10 ) ? "0": "")+ hoursnouyue + ":";
      timeValueniuyue += ((minutes < 10) ? "0" : "") + minutes + ":";
      timeValueniuyue += ((seconds < 10) ? "0" : "") + seconds;
      document.getElementById(niuyue).innerHTML = timeValueniuyue;
      
      timeValuedongjing = "";
      if((hours-23)<0)
      {
        hoursdongjing=24-(23-hours);
      }
      else
      {
        hoursdongjing=hours-23;
      }
      timeValuedongjing += ((hoursdongjing <10 ) ? "0": "")+ hoursdongjing + ":";
      timeValuedongjing += ((minutes < 10) ? "0" : "") + minutes + ":";
      timeValuedongjing += ((seconds < 10) ? "0" : "") + seconds;
      document.getElementById(dongjing).innerHTML = timeValuedongjing;
      setTimeout("showtime()",1000);
    }
    showtime();
</script>
</div>

上一篇:没有了! 下一篇:没有了!
我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!
最新发布
热门文章
Web Lite SWeTE: Simple Website Translation Engine
 


设为首页 | 加入收藏 | 意见建议 | 友情链接 | 版权声明 | 管理登陆 | 编程论坛 | 给我留言

声明:本网站部分稿件来源的所有文字、图片和音视频稿件,来自互联网,若侵犯您的权利,请来信告知,我们将在第一时间内删除!


Copyright 2009-2015 redrose ( wgbcw.cn ) All rights reserved ICP备案编号:滇ICP备09007156号 Dict.cn


点击这里给我发消息
点击这里给我发消息
安全联盟站长平台