跟小D每日学口语

简单ASP计数器

<html>
<head>
<title>ASP图形计数器</title>
</head>

<body>
<%
int visitors
If IsEmpty(Session("visitors")) Then
    file=server.mappath("counter.txt")
    Set files = CreateObject("Scripting.FileSystemObject")
    Set openfile = files.OpenTextFile(file)

    visitors=openfile.readline
    openfile.close   

   visitors=visitors+1
   Set out=files.CreateTextFile(file)
   out.WriteLine(visitors)
   out.close  
Else   
    visitors = Cint(Session("visitors"))
End If

countsize=len(visitors)
for n=1 to countsize
response.write "<img src=" & mid(visitors,n,1) & ".gif>"
next

Session("visitors") = visitors
%>

</body>
</html>

posted @ 2008-06-18 09:42  javak  阅读(318)  评论(0编辑  收藏  举报