Results 1 to 2 of 2

Thread: urgent

  1. #1
    Join Date
    Dec 1969

    Default urgent

    i have just started learning asp, how can i add a counter to a page ( a single html page)

  2. #2
    Join Date
    Dec 1969

    Default RE: urgent

    *<BR><BR>i got this from www.ultimateasp.com<BR><BR>CODE -- <BR> &#060;%Set FileObject = Server.CreateObject("Scripting.FileSystemObject")H itsFile = Server.MapPath ("/main/sample") & "hits.txt"Set InStream= FileObject.OpenTextFile (HitsFile, 1, false )OldHits = Trim(InStream.ReadLine)NewHits = OldHits + 1Set OutStream= FileObject.CreateTextFile (HitsFile, True)OutStream.WriteLine(NewHits)%&#062;This page has been accessed &#060;%=NewHits%&#062; times.<BR> <BR> COMMENTS -- <BR> I don&#039t think there is any other hit counter is as easy as this one.<BR><BR>Create a text file first called "hits.txt" and type "1" in the file as the initial hit.<BR><BR>The Server.MapPath is the directory under your root where this text file is saved. <BR><BR>The codes above read the number in the text file, add it with 1, overwrite the old hit, and display it.<BR><BR> <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts