注册 登录
编程论坛 ASP技术论坛

图形计数器的代码 其中红色部分小弟看的不是很明白,希望有详细的解读

chinatao 发布于 2011-04-15 14:07, 422 次点击
图形计数器的代码 其中红色部分小弟看的不是很明白,希望有详细的解读

<%
 function g_counts(counterfile)
 dim objfso,objts,cpunts,strcounts
  application.lock
  set objfso=server.createobject("scripting.filesystemobject")
  set objts=objfso.opentextfile(server.mappath(counterfile),1,true)
if not objts.atendofstream then
 counts=clng(objts.readline)
end if
counts=counts+1
objts.close
set objts=objfso.opentextfile(server.mappath(counterfile),2,true)
objts.writeline(counts)
objts.close
application.unlock
strcounts=cstr(counts)
for i=1 to len(strcounts)
  g_counts=g_counts&"<img src=image/shuzi"&mid(strcounts,i,1)&".jpg>"
next
end function
%>
<html>
<body>
<p><img src="top.jpg"></p>
你是第<% response.write g_counts("counter2.txt") %>位访客<br>
最后一次的浏览日期:<% response.write application("lastvisitdate")%>
<% application("lastvisitdate")=now() %>
</body>
</html>

0 回复
1