请问如何使用asp读取txt文件内容,并显示在textarea中呢

来源:百度知道 编辑:UC知道 时间:2024/06/02 01:17:47
比如有一个文件为1.txt,那么如何使用asp读出来,并且能够显示在下面textarea里呢?
<textarea name='neirong' cols='60' rows='4' id='111'>txt文件中读出的内容</textarea>
不要网上拷贝下就给我呀,请帮忙说的仔细些,怎么把txt读出的内容放到textarea中........

whichfile=server.mappath("txt.txt")
Set fso = CreateObject("Scripting.FileSystemObject")
Set txt = fso.OpenTextFile(whichfile,1)
dim rline1=""
While Not txt.AtEndOfStream
rline =txt.ReadLine'读取一行
rline1=rline1&rline

<textarea name='neirong' cols='60' rows='4' id='111' value='<%=rline1%>'>

whichfile=server.mappath("txt.txt")
Set fso = CreateObject("Scripting.FileSystemObject")
Set txt = fso.OpenTextFile(whichfile,1)
While Not txt.AtEndOfStream
rline =txt.ReadLine'读取一行

....

下面他就循环读了呀、看你怎么处理读出来的内容了.
是放页面上?还是弄个textbox控件?
还是怎么样、然后自己处理下吧.

whichfile=server.mappath("txt.txt")
Set fso = CreateObject("Scripting.FileSystemObject")
Set txt = fso.OpenTextFile(whichfile,1)
TextStr=txt.readall() '读取文本文件中所有内容
set txt=nothing<