[Javascript] Odometer Number Display

Peter Brunone peter at brunone.com
Tue Dec 11 15:16:49 CST 2001


var image0 = new Image;
image0.src = image0.gif;

var image1 = new Image;
image1.src = image1.gif;

var image2 = new Image;
image2.src = image2.gif;

// and so on for all the numbers

    Then you'd create an odometer display out of six or seven number images,
name them all sequentially, and initially fill them with the zero image.
Taking the number (making sure to pass it as a string and not as an
integer), you'd parse it one digit at a time making use of the string.length
and string.substring functions; for each digit, you'd run a case statement
and then change the appropriate image's .src attribute to the corresponding
image variable's .src attribute.

    If that's just a bunch of gobbledygook, and nobody gives you a
ready-made script, let us know how far you've gotten and we'll work it some
more.

Cheers,

Peter

----- Original Message -----
From: "srpatterson" <Steve12 at iname.com>
To: <Javascript at LaTech.edu>
Sent: Tuesday, December 11, 2001 1:40 PM
Subject: [Javascript] Odometer Number Display


| Does anyone have a script to produce an odometer display for a given
| number? Not a counter necessarily, but just any number that you pass
| to the function. Could be as simple as ten images and a routine to
| display those ten images in the order needed.
| Thanks
|
|
| _______________________________________________
| Javascript mailing list
| Javascript at LaTech.edu
| https://lists.LaTech.edu/mailman/listinfo/javascript
|




More information about the Javascript mailing list