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%> Code (markup): 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
I am not sure which is the variable to display the counter data from your code. But it is easy to display as per your requirement. u can use the following code <div style="height:50px; width:100px; border: #993300 solid 1px; font-family: 'Times New Roman', Times, serif; font-size:12px;"> <% Response.Write(strCounterText) %> </div> Where strCounterText is the variable to hold the counter values.
you can add "border-style: dashed", other border styles: none Specifies no border hidden The same as "none", except in border conflict resolution for table elements dotted Specifies a dotted border dashed Specifies a dashed border solid Specifies a solid border double Specifies a double border groove Specifies a 3D grooved border. The effect depends on the border-color value ridge Specifies a 3D ridged border. The effect depends on the border-color value inset Specifies a 3D inset border. The effect depends on the border-color value outset Specifies a 3D outset border. The effect depends on the border-color value inherit Specifies that the border style should be inherited from the parent element
Hello Many thanks to you both for your posts. I have resolved the query I had, so the page now looks like this: http://proofreading4students.com/my_counter.asp The colouring and size of that number is only a sample - I was just testing it. How, now, would I go about putting a little box around it? I would probably prefer a thin solid border of whatever colour. This is what I have in the code now: %> <span style="font-family: arial; font-size: 16pt; font-weight: bold; color: #333399;"><%=iCounterNumber%></span> <% Code (markup): Thanks again for your help. High1