Results 1 to 5 of 5

Thread: ASP Counters

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    W.Lafayette, In USA
    Posts
    37
    I have a web page that display on the left a menu bar. It has a home link on it. I want to be able to implement a smart hit counter whenever someone accesses the page but not everytime they click on the home link.

    Please I need your help on this

    Thanks in advance
    "Juanyta"

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    you could put the hitcounter in an inital frame page and for the home link just reload to the frame.
    Mark
    -------------------

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Here's the sort of thing I mean:


    default.asp
    Code:
    <%@ Language=VBScript %>
     <%option explicit%>
     <HTML>
     <%
             Const ForReading = 1, ForWriting = 2, ForAppending = 8
             Dim Visitor, fso, MyFile, Data
             
             Set fso = CreateObject("Scripting.FileSystemObject")
             
             Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForReading, True)
             Data = MyFile.ReadLine
             Visitor = CInt(Data)
           
            
    		MyFile.Close
            
             Visitor = Visitor + 1
             Response.Write "<script language=javascript>"& vbcrlf
            Response.Write "var count=" & Visitor & vbcrlf
    		Response.Write "</script>"
             
             Set fso = CreateObject("Scripting.FileSystemObject")
             Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
             MyFile.Write Visitor
             MyFile.Close
    
     %>
      <Frameset cols="100,*">
    	<frame name=left src="./left.htm">
    	<frame name=main src="http://forums.vb-world.net">
    </frameset>
     </HTML>
    left.htm
    Code:
    <HTML>
    <HEAD>
    
    <script language=javascript>
    function goHome()
    {
    parent.main.location='./jbhome.htm';
    }
    </script>
    </HEAD>
    <BODY>
    
    <script language=javascript>
    document.write("<h2>Visitors: " + parent.count + "</h2>")
    
    </script>
    <A href="javascript:goHome();">Home</A>
    </BODY>
    </HTML>
    jbhome.asp
    Code:
    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    </HEAD>
    <BODY>
    
    <H1>Jay=B HOME</H1>
    
    </BODY>
    </HTML>
    Mark
    -------------------

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    W.Lafayette, In USA
    Posts
    37

    ?

    Does it need this <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> in it to work. If so what does that mean.

    Thanks for all your help

    Jay-B

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Interdev puts that in automatically (as do nearly all M$ editors)

    I usually delete it but I missed that one.

    just ignore it!

    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width