Results 1 to 2 of 2

Thread: I want to be able to open a plain text file in JAVASCRIPT and be able to read as text

  1. #1
    Join Date
    Jul 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I want to be able to open a plain text file in JAVASCRIPT and be able to read as text

    I want to be able to open a plain text file in JAVASCRIPT and be able to read as text. .


    I able to write text in .text file But i cant able to read or open file.here is javascript code...Please advice.

    <script language="javascript" type="text/javascript">
    var fso, ts;
    var ForWriting= 2;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    ts = fso.CreateTextFile("c:\\test.txt", 2, true,0);
    ts.Close();
    ts.write("ia javascript");
    var ForReading = 1, openfile;
    openfile = fso.OpenTextFile("c:\\test.txt", 1);
    if(openfile =-1)
    {
    var obj = openfile.ReadAll();
    //var obj = openfile.ReadLine();
    Response.Write("File contents:" +obj);
    }


    </script>

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Why is this in the mysql section? Is this not a JavaScript question? It should be posted there.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •