CodeAve.com CodeAve.com - ASP - Read/Write
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Hit Counter (With Images)
There are many ways to track usage of a website. The simplest way is with a hit counter. The code provided below is one of the simplest hit counters that can be made in .asp. A text document (asp_count.txt) is placed in the same directory (providing that directory has write access, you may need to place the .txt document in your cgi-bin depending on your provider) as the page we want the counter to appear on. The .txt file is first read to gain the value of the last hit count, one is added to that number, written to the .txt document, closed and the length of the counter value is used to create a for next loop that correspond to image names on the server to bring about the "common image hitcounter". Refresh the content of the output page for a more complete illustration.
View the Output
Text View
Print View
Mail this Link
Download the Code

<title>CodeAve.com(Hit Counter with Images)</title>
<body bgcolor="#FFFFFF">

<%
'open a text document a read the top line for
'the current hit count
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath("asp_count.txt"))
counter = clng(act.readline)
'add one to the current count
counter = counter + 1
act.close

'write a new text object with the same name
'and new hit count
Set act = fso.CreateTextFile(server.mappath("asp_count.txt"), true)
act.writeline(counter)
act.close

' grab the length of the counter
counter_length = len(counter)

'loop through the hit count number by
'number and display the appropriate image
'for each numeric in the hit count
for i = 1 to counter_length
%>
<img src="images/<%= mid(counter,i,1) %>.gif"><% 
next %>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3