<% Function ShowCode(filename) Set fso = Server.CreateObject("Scripting.FileSystemObject") Set cnrs = fso.OpenTextFile(filename, 1) While Not cnrs.AtEndOfStream rsline = cnrs.ReadLine rsline = server.HTMLEncode(rsline) Response.Write(rsline & "<br>") Wend end Function %>
<% If not request.Form("NextLine")="" then Set fso=Server.CreateObject("Scripting.FileSystemobject") textfile1=Server.MapPath("story.txt") set cnrs=fso.OpenTextFile(textfile1,8) cnrs.WriteLine(Request.Form("NextLine")) cnrs.Close end if %> 故事如下: <% Set fso=Server.CreateObject("Scripting.FileSystemObject") textfile1=Server.MapPath("story.txt") set cnrs=fso.OpenTextFile(textfile1,1) while not cnrs.AtEndOfStream Response.Write " " & cnrs.ReadLine wend cnrs.close %> <hr> <form method="post" action="story.asp"> 请输入这个故事的新行:<input name="NextLine" type="text" size="70"> <input type="submit" value="提交"> </form>
<% whichfile=server.mappath("site.txt") set fso=createobject("Scripting.FileSystemObject") set thisfile=fso.opentextfile(whichfile) my_string=thisfile.readline
select case request.form("website") case "A": a_value=a_value+1 case "B": b_value=b_value+1 case "C": c_value=c_value+1 case "D": d_value=d_value+1 end select