|
Graphical Counter
This is
a simple to implement graphical counter and in this example
we are going to show you a variety of different digits . In
this example you will have to create a text file called gcounter1.txt
and put the number you wish to start the count from.
Firstly
here is the main part of the script
<%
'declare our variables
Dim objFSO , objFile,objTextStream, CounterFile , Count , Digits
'initialize
Count = 0
'get path to counter file
CounterFile = Server.MapPath("gcounter1.txt")
'create instances of our objects
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(CounterFile)
Set objTextStream = objFile.OpenAsTextStream
'read count from file and increment by 1
Count = Clng(objTextStream.ReadLine)
Count = Count + 1
'create the visitor count file
Set objTextStream = objFSO.CreateTextFile(Server.MapPath("gcounter1.txt"))
'write new count to file
objTextStream.Write Count
'reset all variables
objTextStream.Close
Set objFile = Nothing
Set obFSO = Nothing
Set objTextStream = nothing
%>
Now lets display some counters .
Counter 1
<%
For i = 1 to Len(Count)
Response.Write "<img src=""images/1/"
& Mid(Count, i, 1) & ".gif" & """>"
Next
Response.Write "<br>"
%>
Counter 2
<%
For i = 1 to Len(Count)
Response.Write "<img src=""images/5/"
& Mid(Count, i, 1) & ".gif" & """>"
Next
%>
The digits for these counters were found at http://www.counterart.com
, these are available as zip files so we download them and
then unzip them in our image directory into their own folders.
|