例子
<!-- Story.asp -->
<%
IF NOT Request.Form("NextLine")="" THEN
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.OpenTextFile("d:\story.txt", 8, TRUE)
MyTextFile.WriteLine(Request.Form("NextLine"))
MyTextFile.Close
END IF
%>
<HTML>
<HEAD><TITLE> Online Story </TITLE></HEAD>
<BODY>
<HR>
<%
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.OpenTextFile("d:\story.txt")
WHILE NOT MyTextFile.AtEndOfStream
Response.Write(" "&MyTextFile.ReadLine)
WEND
MyTextFile.Close
%>
<HR>
<H3>Enter a new line for the story: </H3>
<FORM METHOD="POST" ACTION="story.asp">
<INPUT NAME="NextLine" TYPE="TEXT" SIZE=70 maxlength="100">
<INPUT TYPE="SUBMIT" VALUE="Submit Sentence">
</FORM>
</BODY>
</HTML>
文章来源于领测软件测试网 https://www.ltesting.net/