asp最简单最实用的计数器

2019-01-13 16:54:22王冬梅

  Function count_show  '读取计数函数 
  set fs=Server.CreateObject("Scripting.FileSystemObject") 
  filename=server.MapPath("count.txt") 
    set txt=fs.opentextfile(filename,1,true) 
  total=txt.readline 
  total=cint(total) 
  'response.write total 
  response.write Digital (total) '调用显示函数 
  set fs=nothing 
  End Function 

%>



  然后新建一个count.txt(必须和count.asp同一级目录),打开这个文件后在里面输入任意数字(别太狠啦),然后在需要显示计数器的那个页面顶部加入

<!--#include file="count.asp"--> 


最后在需要显示计数器的地方加上代码

<%=count_show%> 


就OK了。