⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 count.asp

📁 项目开发对初学者来说非常重要
💻 ASP
字号:
<%
Dim Counter
Sub IncrementCounter()
    ' 建立一 FileSystemObject 对象
    Set fs = Server.CreateObject("Scripting.FileSystemObject")
    counter_file = Server.MapPath("/counter.txt")

    ' 启动 /counter.txt 文件,并且读取记录在文件中的 counter
    Set txt = fs.OpenTextFile( counter_file )
    Counter = txt.ReadLine
    txt.Close

    ' 将计数器加一
    Counter = Counter + 1

    ' 将计数器写入 /counter.txt 文件之中
    Set txt = fs.CreateTextFile( counter_file, True )
    txt.WriteLine(Counter)
    txt.Close
End Sub

If IsEmpty(Session("Connected")) Then
	Application.Lock
	IncrementCounter   ' 将访问者计数器加一,并写入文件中
	Application.UnLock
End If 
Session("Connected") = True%>

Function GCounter( counter )
   Dim S, i, G
   S = CStr( counter )  '先将数值转换成字符串
   '逐个取字符串 S 的每个字节,然后串成<IMG SRC=?.gif> 图形标记
   For i = 1 to Len(S)
      G = G & "<IMG SRC=" & Mid(S, i, 1) & ".gif Align=TextTop>"
   Next
   GCounter = G
End Function
%>

<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=gb_2312-80">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title></title>
</head>
<body bgcolor="#FFFFFF">
<h2 align="center">欢迎访问star的个人主页</h2>
<hr>
<p align="center">您是本站第 <%=GCounter(Application("counter"))%> 位贵宾! </p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -