当前位置:编程学习 > asp >>

asp+txt创建简单的计数器

asp+txt创建简单的计数器

文件如下:
<%
dim vis
set js=createobject("scripting.filesystemobject")
set f=js.createtextfile("D:/count.txt",true)
f.writeline 0
f.close
whichfile=js.getfile("D:/count.txt")
set thisfile=js.opentextfile(whichfile)
vis=thisfile.readline
thisfile.close
vis=vis+1
response.write vis
set out=js.createtextfile(whichfile)
out.writeline vis
out.close
%>
//测试只显示1,而不刷新为2,依以类推.
如果把上面建立的文件d:/count.txt,这部分去掉,文件如下:
<%
dim vis
set js=createobject("scripting.filesystemobject")
whichfile=js.getfile("D:/count.txt")
set thisfile=js.opentextfile(whichfile)
vis=thisfile.readline
thisfile.close
vis=vis+1
response.write vis
set out=js.createtextfile(whichfile)
out.writeline vis
out.close
%>

补充:asp教程,ASP入门
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,