
Reading a text file and piping it into a text box
Thank you. The <iFrame> worked like a charm.
Sam
Quote:
>-----Original Message-----
>sam,
><textarea rows="10" columns="5" name="text1" id="text1"/>
is a multi-line
>text box
>or you could use <iFrame width="100" height="100"
src="d:\labs\marx.txt"/>
Quote:
>bypassing vbscript alltogether
>-hman
>> Im not sure if textbox can support multiline, but you
can try the
>following
>> asp code.
>> <HTML>
>> <HEAD>
>> <META NAME="GENERATOR" Content="Microsoft Visual Studio
6.0">
>> <TITLE></TITLE>
>> <%
>> Set fs = CreateObject( "Scripting.FileSystemObject")
>> Set readfile = fs.OpenTextFile( "d:\labs\marx.txt",
1)
>> response.write( "<SCRIPT LANGUAGE=vbscript>" & chr
(13))
>> Do until readfile.AtEndOfStream
>> Text = readfile.readline
>> response.write( "sText = sText & """ & Text
& """" & chr(13))
>> Loop
>> readfile.close
>> set readfile=nothing
>> response.write( "</SCRIPT>")
>> %>
>> <SCRIPT LANGUAGE=vbscript>
>> <!--
>> sub window_onload()
>> text1.value = sText
>> end sub
>> //-->
>> </SCRIPT>
>> </HEAD>
>> <BODY LANGUAGE=vbscript onload="call window_onload">
>> <INPUT id=text1 name=text1>
>> </BODY>
>> </HTML>
>> > Greetings. I can use the following code segment to
read the contents
>> > of a text file (called writefile.txt) and display it
on the screen.
>> > <%
>> > Set fs = CreateObject
("Scripting.FileSystemObject")
Quote:
>> > filename=server.mappath("writefile.txt")
>> > Set readfile=fs.OpenTextFile(filename,1,False)
>> > Do until readfile.AtEndOfStream
>> > Text=readfile.readline
>> > If Text="" then
>> > response.write "<p>"
>> > Else
>> > response.write Text
>> > End If
>> > Loop
>> > readfile.close
>> > set readfile=nothing
>> > %>
>> > I am not sure how to modify this code to have it
display in a text box
Quote:
>> > on a page. I would like to have an small text box
called "News" where
>> > I can put a message of the day, etc. Any help would
be greatly
>> > appreciated. Thanks.
>> > Sam
>.