name:cnbruce sex:male |
% whichfile=server.mappath("info.txt") Set fso = CreateObject("Scripting.FileSystemObject") Set txt = fso.OpenTextFile(whichfile,1) rline = txt.ReadLine rline = rline "br>" txt.ReadLine Response.Write rline txt.Close %> |
% whichfile=server.mappath("info.txt") Set fso = CreateObject("Scripting.FileSystemObject") Set MyFile = fso.CreateTextFile(whichfile,True) MyFile.WriteLine("My Name Is CN-Bruce") MyFile.WriteLine("My Sex Is Male") MyFile.Close %> a href="opentxt.asp">查看内容/a> |
1 |
% whichfile=server.mappath("counter.txt") '打开文件并将其值读取,最后关闭连接释放资源 set fso=createobject("Scripting.FileSystemObject") set openfile=fso.opentextfile(whichfile,1) visitors=openfile.readline openfile.close '页面显示记数内容并做加1运算 response.write "您是本页的第"visitors"位访客" visitors=visitors+1 '将新的数值添加写入到文本,最后关闭所有连接释放资源 set creatfile=fso.createtextfile(whichfile) creatfile.writeLine(visitors) creatfile.close set fso=nothing %> |
% whichfile=server.mappath("counter.txt") set fso=createobject("Scripting.FileSystemObject") set openfile=fso.opentextfile(whichfile,1) visitors=openfile.readline openfile.close CountLen=len(visitors) response.write "您是本页的第" for i=1 to 6-countLen '表示最大值999999 response.write "img src=img/0.gif>/img>" next for i=1 to countlen response.write "img src=img/" mid(visitors,i,1) ".gif>/img>" next response.write "位访客" visitors=visitors+1 set creatfile=fso.createtextfile(whichfile) creatfile.writeLine(visitors) creatfile.close set fso=nothing %> |