March 16, 201016 yr Hello I have a simple ASP counter script which digits in text format: <%@ Language = VBSCRIPT %> <% Option Explicit %> <% ' Variable Section Const ForReading = 1 Const ForWriting = 2 Const UseText = 0 ' Use this constant if you want to use text for the counter display Const UseImages = 1 ' Use this constant if you want to use images for the counter display Dim objCounterFile, objFSO, strFilePath, strImageName, displayOption, imageDirectory Dim strCounterNumber, iCounterNumber, strCurrentIP, strLastIP ' Set this equal either to 0 or 1, make it equal either UseImages of UseText ' depending on which you want to use to show your counter. displayOption = 0 ' Set this string equal to the sub-directories that you follow to your images directory ' This is from the directory that contains the file that executes "counter.asp" imageDirectory = "images/" ' ' Gathering information strCurrentIP = Request.ServerVariables("REMOTE_ADDR") strFilePath = Server.MapPath("counter.txt") Set objFSO = Server.CreateObject("Scripting.FileSystemObject") ' ' Checking for the file counter.txt If (objFSO.FileExists(strFilePath)) then Set objCounterFile = objFSO.OpenTextFile(strFilePath, ForReading) ' Reading the information in from the text file iCounterNumber = Cdbl(objCounterFile.ReadLine) + 1 strLastIP = Cstr(objCounterFile.ReadLine) objCounterFile.Close Else ' If the doesn't exist start counting at 1 iCounterNumber = 1 End If ' ' If the current visitor's IP is different from the last visitor's IP then log the new information If (strLastIP <> strCurrentIP) then Set objCounterFile = objFSO.CreateTextFile(strFilePath, True) objCounterFile.WriteLine(iCounterNumber) objCounterFile.WriteLine(strCurrentIP) objCounterFile.Close Else iCounterNumber = iCounterNumber - 1 End If ' ' Destroying the Objects Set objCounterFile = Nothing Set objFSO = Nothing ' ' Setting up the number to be displayed ' This setup allows for later changing to images from text strCounterNumber = CStr(iCounterNumber) While (Len(strCounterNumber) > 0) strImageName = Left(strCounterNumber, 1) If (displayOption = UseText) then Response.Write (strImageName) Elseif (displayOption = UseImages) then Response.Write ("<IMG SRC=""" & imageDirectory & strImageName & ".gif"" BORDER=0>") End If strCounterNumber = Mid(strCounterNumber, 2) Wend %> The output is simple Times Roman at about 10/12pt. How (or where) would I begin to format the output - to a differrnt font, say, or size, or maybe include it in a small box with a border? Many thanks for any ideas. High1
March 17, 201016 yr I use php - not ASP, but it looks like the counter is currently set to display as images rather than text. change the 'displayOption' to equal 1 (not 0), this should then display the counter as text....I would then imagine that you should be able to alter the text size by using CSS.
Create an account or sign in to comment