Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Formatting simple counter

Featured Replies

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

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.