PDA

Click to See Complete Forum and Search --> : ASP Counters


Jay=B
Nov 14th, 2000, 07:46 PM
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"

Mark Sreeves
Nov 15th, 2000, 06:30 AM
you could put the hitcounter in an inital frame page and for the home link just reload to the frame.

Mark Sreeves
Nov 15th, 2000, 07:17 AM
Here's the sort of thing I mean:


default.asp


<%@ 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

<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

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>

<H1>Jay=B HOME</H1>

</BODY>
</HTML>

Jay=B
Nov 15th, 2000, 09:28 AM
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

Mark Sreeves
Nov 15th, 2000, 09:32 AM
Interdev puts that in automatically (as do nearly all M$ editors)

I usually delete it but I missed that one.

just ignore it!