Count. asp
<Html>
<Head>
<Meta http-equiv = "Content-Type"
Content = "text/html; charset = gb2312">
<Title> change counter for dancing with the Wind </title>
</Head>
<Body>
<P>
<%
Dim out
Countfile = server. mappath ("aspcount.txt ")
Set objfile = server. createobject ("scripting. filesystemobject ")
'Define a server component.
Set out = objfile. opentextfile (countfile, 1, false, false)
Counter = out. readline
'Read data.
Out. close
Set objfile = server. createobject ("scripting. filesystemobject ")
Set out = objfile. createtextfile (countfile, trUE, FALSE)
Application. lock
'Temporarily locked.
Counter = counter + 1
'Number of visitors plus 1.
Out. writeline (counter)
'Write data.
Application. unlock
'Unlock.
Out. close
%>
<Script language = "avascript">
Function countdisp (countvar ){
Var countvar1 = "000000" + countvar;
'Achieve random display, with less than 6 digits supplemented with 0.
Var howFar1 = countvar1.length;
Countvar1 = countvar1.substring (howfar1. howFar1-1)
Var index = "" + Math. floor (Math. random () * 10 );
If (index = "10 "){
Index = "0 "};
For (var icount = 0; icount <6; icount ++ = {
Var g = countvar1.substring (icount, icount + 1 );
Document. images [icount]. src = "http ://
Localhost/images/"+ index + g +". gif ";
}
=
</Script> </p>
<! -- Preload Image array -->
visitor!
<Script language = "avascript">
Count (counter );
'Call the count () function to display the dynamic image of the counter.
</Script>
</Body>
</Html>
[1]