广告联盟网

 找回密码
 注册
查看: 511|回复: 1
打印 上一主题 下一主题

比较好玩的时间代码

[复制链接]
跳转到指定楼层
1#
发表于 2007-1-19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
送大家一段刚偷的代码:

<SCRIPT LANGUAGE="JavaScript">
    var dn;
    c1 = new Image(); c1.src = "http://www.lohcn.org/forum/digital-clock/c1.gif";
    c2 = new Image(); c2.src = "http://www.lohcn.org/forum/digital-clock/c2.gif";
    c3 = new Image(); c3.src = "http://www.lohcn.org/forum/digital-clock/c3.gif";
    c4 = new Image(); c4.src = "http://www.lohcn.org/forum/digital-clock/c4.gif";
    c5 = new Image(); c5.src = "http://www.lohcn.org/forum/digital-clock/c5.gif";
    c6 = new Image(); c6.src = "http://www.lohcn.org/forum/digital-clock/c6.gif";
    c7 = new Image(); c7.src = "http://www.lohcn.org/forum/digital-clock/c7.gif";
    c8 = new Image(); c8.src = "http://www.lohcn.org/forum/digital-clock/c8.gif";
    c9 = new Image(); c9.src = "http://www.lohcn.org/forum/digital-clock/c9.gif";
    c0 = new Image(); c0.src = "http://www.lohcn.org/forum/digital-clock/c0.gif";
    cb = new Image(); cb.src = "http://www.lohcn.org/forum/digital-clock/cb.gif";
    cam = new Image(); cam.src = "http://www.lohcn.org/forum/digital-clock/cam.gif";
    cpm = new Image(); cpm.src = "http://www.lohcn.org/forum/digital-clock/cpm.gif";
   
    function extract(h,m,s,type) {
      if (!document.images) return;
      
      if (h <= 9) {
        document.images.a.src = cb.src;
        document.images.b.src = eval("c"+h+".src");
      }else {
        document.images.a.src = eval("c"+Math.floor(h/10)+".src");
        document.images.b.src = eval("c"+(h%10)+".src");
      }
      
      if (m <= 9) {
        document.images.d.src = c0.src;
        document.images.e.src = eval("c"+m+".src");
      }else {
        document.images.d.src = eval("c"+Math.floor(m/10)+".src");
        document.images.e.src = eval("c"+(m%10)+".src");
      }
      
      if (s <= 9) {
        document.g.src = c0.src;
        document.images.h.src = eval("c"+s+".src");
      }else {
        document.images.g.src = eval("c"+Math.floor(s/10)+".src");
        document.images.h.src = eval("c"+(s%10)+".src");
      }
      
      if (dn == "AM") document.j.src = cam.src;
        else document.images.j.src = cpm.src;
    }
   
    function show3() {
      if (!document.images)
        return;
      var Digital = new Date();
      var hours = Digital.getHours();
      var minutes = Digital.getMinutes();
      var seconds = Digital.getSeconds();
      dn = "AM";
      if ((hours >= 12) && (minutes >= 1) || (hours >= 13)) {
        dn = "M";
        hours = hours-12;
      }
      if (hours == 0)
        hours = 12;
      extract(hours, minutes, seconds, dn);
      setTimeout("show3()", 1000);
    }
</script>
</head><BODY onLoad="show3()" bgcolor="#000000"><img height=18 src="http://www.lohcn.org/forum/digital-clock/cb.gif" width=16 name=a><img height=18 src="http://www.lohcn.org/forum/digital-clock/cb.gif" width=16 name=b><img height=18 src="http://www.lohcn.org/forum/digital-clock/colon.gif" width=9 name=c><img height=18 src="http://www.lohcn.org/forum/digital-clock/cb.gif" width=16 name=d><img height=18 src="http://www.lohcn.org/forum/digital-clock/cb.gif" width=16 name=e><img height=18 src="http://www.lohcn.org/forum/digital-clock/colon.gif" width=9 name=f><img height=18 src="http://www.lohcn.org/forum/digital-clock/cb.gif" width=16 name=g><img height=18 src="http://www.lohcn.org/forum/digital-clock/cb.gif" width=16 name=h><img height=18 src="http://www.lohcn.org/forum/digital-clock/cam.gif" width=16 name=j></body>

2#
 楼主| 发表于 2007-1-19 | 只看该作者
自己把所有的图片都保存下来就好了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|广告联盟网  

GMT, 2024-11-26 , Processed in 0.071714 second(s), 20 queries .

Powered by Discuz! X3.2

© 2005-2021 www.ggads.com GGADS 广告联盟网

快速回复 返回顶部 返回列表