利用JavaScript生成图片时钟

原创 2004年07月16日 11:35:00
<script>
n0=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x5,0x5,0x5,0xF}";
n1=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0x4,0x4,0x4,0x4,0x4}";
n2=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x4,0xF,0x1,0xF}";
n3=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x4,0xF,0x4,0xF}";
n4=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0x5,0x5,0xF,0x4,0x4}";
n5=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x1,0xF,0x4,0xF}";
n6=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x1,0xF,0x5,0xF}";
n7=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x4,0x4,0x4,0x4}";
n8=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x5,0xF,0x5,0xF}";
n9=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0xF,0x5,0xF,0x4,0xF}";
nD=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0x0,0x0,0xF,0x0,0x0}";
nS=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0x0,0x0,0x0,0x0,0x0}";
nT=
"#define t_width 3/n"
+"#define t_height 5/n"
+"static char t_bits[]={0x0,0xF,0x0,0xF,0x0}";
function setImg()
{
 var now=new Date();
 var month=now.getMonth()+1;
 var strNow=strFormat(""+now.getYear(),4)+"D"+strFormat(""+month,2)+"D"+strFormat(""+now.getDate(),2)+"S"+strFormat(""+now.getHours(),2)+"T"+strFormat(""+now.getMinutes(),2)+"T"+strFormat(""+now.getSeconds(),2)+"T"+strFormat(""+now.getMilliseconds(),3);
 ClockID.innerHTML="";
 var vImg="";
 for(iInde=0;iIndex<strNow.length;iIndex++)
 {
  vImg=vImg+"<img src=/"javascript:n"+strNow.substr(iIndex,1)+";/" width=/"9/" height=/"15/">/n";
  ClockID.innerHTML=vImg;
 }
}
function strFormat(str,iLen)
{
 if(str.length<iLen)
 {
  for(iIndex=0;iIndex<iLen-str.length;iIndex++)
  {
   str="0"+str;
  }
  return str;
 }
 else
 {return str;}
}
setInterval("setImg()",2000);
</script>
<center>
<div id="ClockID">
</div>
</center>

纯Js生成时钟 带星期 如2017-01-10 19:21:53 星期二

代码很简单,当然这段代码已经不知道流传了多少年了,确实有效,简单直接。 下面线上效果图: 献上代码: function getDate() { var d,s,t...
  • dcb_ripple
  • dcb_ripple
  • 2017-01-10 19:40:56
  • 460

使用JavaScript实现制作动态时钟

1:clock.js /** * 动态显示当前时间 */ function showDateTime(){ var sWeek=new Array("日","一","二","三",...
  • pangqiandou
  • pangqiandou
  • 2017-09-25 23:34:30
  • 617

JavaScript canvas 绘制圆形时钟

canvas 绘制时钟
  • u012104947
  • u012104947
  • 2016-04-19 15:20:06
  • 556

JS实现网页时钟

网页时钟 function displayTime(){ //1.获取div元素 var timeDiv=document.getElementById("timeDiv"); //2.获...
  • pangqiandou
  • pangqiandou
  • 2017-10-16 23:05:51
  • 701

"JavaScript时钟"(指针式样的)

"JavaScript时钟"(指针式样的)要完成此效果需要三个步骤第一步:把如下代码加入到区域中...
  • airweilai
  • airweilai
  • 2008-06-14 08:42:00
  • 309

javascript显示时钟

Date对象表示日期和时间。有四种定义方式:var t = new Date();var t = new Date(milliseconds);var t = new Date(datestring)...
  • jiagun4
  • jiagun4
  • 2006-05-15 18:50:00
  • 1313

用JAVASCRIPT语句实现电子时钟

实例化date类today = new Date();分别取时、分、秒的数值intHours = today.getHours();intMinutes = today.getMinutes();in...
  • ztmaster
  • ztmaster
  • 2005-05-26 17:41:00
  • 1825

一个很好用的在线时钟(javascript)

function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); ...
  • abandonship
  • abandonship
  • 2005-06-01 09:32:00
  • 1429

js时钟程序

js时钟程序 img{ width: 25px; height: 25px; } 时钟 function getImg(val) { var len=val.length...
  • zhupengqq
  • zhupengqq
  • 2017-06-30 20:15:05
  • 270

javascript 旋转时钟 使用rotate属性 transform 兼容版本

  • 2013年07月23日 19:22
  • 565KB
  • 下载
收藏助手
不良信息举报
您举报文章:利用JavaScript生成图片时钟
举报原因:
原因补充:

(最多只允许输入30个字)