|
-
Jan 16th, 2001, 06:57 AM
#1
Thread Starter
Junior Member
how can i read a plain text file then output it via document.write?
-
Jan 17th, 2001, 01:39 AM
#2
Hi....
try the following sample code
function GetEverything()
{
var fso, f;
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
f.Write("Header");
f.Write("1234567890987654321");
f.Close();
f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
document.write f.ReadAll
return(f.ReadAll());
}
Regards,
Mac
-
Jan 17th, 2001, 01:43 AM
#3
Thread Starter
Junior Member
does the OpenTextFile function require the absolute path of the file??
-
Jan 17th, 2001, 03:31 AM
#4
-
Jan 17th, 2001, 04:08 AM
#5
Thread Starter
Junior Member
can this method read a file from the webserver or is it from the client machine?
because i need a replacement for <!--#include file""> ssi.
-
Jan 17th, 2001, 07:53 AM
#6
Hi....
Yes but u need to do as below..
in ASP
<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")
then code goes here ....
%>
If for Client Side, in VBScript
Set fso = CreateObject("Scripting.FileSystemObject")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|