利用JavaScript生成图片时钟

<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>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值