[Javascript] Re: Odometer Number Display

srpatterson Steve12 at iname.com
Tue Dec 11 15:48:59 CST 2001


Thanks guys.
I ended up writing something in Asp:

<%
Function NumberToOdometer(intNumber,intLength)

Dim strNumber
Dim strOutput
Dim i

' Create the table and the left side of the odometer
strNumber = CStr(intNumber)
If Len(strNumber)=0 Then strNumber="1234567890"
If intLength < 1 Then intLength = 12
If intLength < Len(strNumber) Then intLength = Len(strNumber)
strOutput = "<table cellpadding=0 cellspacing=0><tr>" & vbCrLf
strOutput = strOutput & "<td><img 
src='images/odometerleft.gif'></td>" & vbCrLf

' Pad in front of the number
For i = 1 to intLength - Len(strNumber)
  strOutput = strOutput & "<td><img src='images/odometer0.gif'></td>" 
& vbCrLf
Next

' Output the number
For i = 1 to Len(strNumber)
  strOutput = strOutput & "<td><img src='images/odometer" & Mid
(strNumber,i,1) & ".gif'></td>" & vbCrLf
Next

' The right side of the odometer and Close the table
strOutput = strOutput & "<td><img 
src='images/odometerright.gif'></td>" & vbCrLf
strOutput = strOutput & "</tr></table>" & vbCrLf

NumberToOdometer = strOutput

End Function
%>
<html>
<body>
<%=NumberToOdometer(Request.QueryString("Num"),Request.QueryString
("Len"))%>
</body>
<html>




More information about the Javascript mailing list