smooth_n4.htm

戻る

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML LANG="ja">

<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=Shift_JIS">
<TITLE>なめらかに回るカウンタ</TITLE>
</HEAD>

<BODY BGCOLOR="#CCFFFF" onLoad="setInterval(timer, 50)">
<CENTER>
<BR><BR>
<B><FONT SIZE="+1" COLOR="#CC0000">なめらかに回るカウンタ</FONT><BR><FONT COLOR="#CC0000">(Netscape 4)</FONT></B>
<BR><BR><BR>

<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR><TD COLSPAN=8><IMG SRC="images/cntr_t.gif" WIDTH=132 HEIGHT=3></TD></TR>
<TR><TD><IMG SRC="images/cntr_l.gif" WIDTH=3 HEIGHT=25></TD>
<TD><ILAYER NAME="digit6" WIDTH=21 HEIGHT=25 LEFT=0 TOP=0>
<LAYER BACKGROUND="images/digit_0.gif" LEFT=0 TOP=0 CLIP="0,0,21,25"></LAYER>
<LAYER LEFT=0 TOP=25 CLIP="0,0,21,0"></LAYER>
</ILAYER></TD>
<TD><ILAYER NAME="digit5" WIDTH=21 HEIGHT=25 LEFT=0 TOP=0>
<LAYER BACKGROUND="images/digit_0.gif" LEFT=0 TOP=0 CLIP="0,0,21,25"></LAYER>
<LAYER LEFT=0 TOP=25 CLIP="0,0,21,0"></LAYER>
</ILAYER></TD>
<TD><ILAYER NAME="digit4" WIDTH=21 HEIGHT=25 LEFT=0 TOP=0>
<LAYER BACKGROUND="images/digit_0.gif" LEFT=0 TOP=0 CLIP="0,0,21,25"></LAYER>
<LAYER WIDTH=21 HEIGHT=25 LEFT=0 TOP=25 CLIP="0,0,21,0"></LAYER>
</ILAYER></TD>
<TD><ILAYER NAME="digit3" WIDTH=21 HEIGHT=25 LEFT=0 TOP=0>
<LAYER BACKGROUND="images/digit_0.gif" LEFT=0 TOP=0 CLIP="0,0,21,25"></LAYER>
<LAYER LEFT=0 TOP=25 CLIP="0,0,21,0"></LAYER>
</ILAYER></TD>
<TD><ILAYER NAME="digit2" WIDTH=21 HEIGHT=25 LEFT=0 TOP=0>
<LAYER BACKGROUND="images/digit_0.gif" LEFT=0 TOP=0 CLIP="0,0,21,25"></LAYER>
<LAYER LEFT=0 TOP=25 CLIP="0,0,21,0"></LAYER>
</ILAYER></TD>
<TD><ILAYER NAME="digit1" WIDTH=21 HEIGHT=25 LEFT=0 TOP=0>
<LAYER BACKGROUND="images/digit_0.gif" LEFT=0 TOP=0 CLIP="0,0,21,25"></LAYER>
<LAYER LEFT=0 TOP=25 CLIP="0,0,21,0"></LAYER>
</ILAYER></TD>
<TD><IMG SRC="images/cntr_r.gif" WIDTH=3 HEIGHT=25></TD></TR>
<TR><TD COLSPAN=8><IMG SRC="images/cntr_b.gif" WIDTH=132 HEIGHT=3></TD></TR>
</TABLE>

</CENTER>

<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
<!--

function timer() {
  if(off == 25) {
    for(; n; n--) {
      with(document.layers["digit" + String(n)].document) {
        layers[0].background.src = layers[1].background.src;
        layers[0].top = 0;
        layers[0].clip.top = 0;
        layers[1].top = 25;
        layers[1].clip.bottom = 0;
      }
    }
    var w = cnt = (cnt + 1) % 1000000;
    for(n = 1; ; n++) {
      document.layers["digit" + String(n)].document.layers[1].background.src = imgs[w % 10].src;
      if(w % 10 != 0)
        break;
      if(n == 6)
        break;
      w = Math.floor(w / 10);
    }
    off = 0;
  }
  off++;
  var i;
  for(i = 1; i <= n; i++) {
    with(document.layers["digit" + String(i)].document) {
      layers[0].top = - off;
      layers[0].clip.top = off;
      layers[1].top = 25 - off;
      layers[1].clip.bottom = off;
    }
  }
}

  imgs = new Array();
  for(i = 0; i < 10; i++) {
    imgs[i] = new Image(21, 25);
    imgs[i].src = "images/digit_" + String(i) + ".gif";
  }

  cnt = 0;
  n = 0;
  off = 25;

//-->
</SCRIPT>

</BODY>

</HTML>