title: read/write csv file using javascript in .htm
body: <p><em>Intro:
  I'm trying to make a html application (.htm) to make some business calculations. The issue that comes is that I need to keep records of everything.
  First I found some visual basic scripts to read/write .mdb files, but that was too complicated for me since I have never worked with vbs.
  So, I decided to use javascript to read/write .csv file</em></p>
  
  <p>This is the function I found for reading:</p>
  
  <pre><code>            function displayClassList() {
              var path="log.csv"
              var fso = new ActiveXObject('Scripting.FileSystemObject'),
              iStream=fso.OpenTextFile(path, 1, false);
              document.getElementById("searchResults").innerHTML="";
              while(!iStream.AtEndOfStream) {
                  var line=iStream.ReadLine();
                  document.getElementById("searchResults").innerHTML += line + "&lt;br/&gt;";
              }
              iStream.Close();
          }
  </code></pre>
  
  <p>It works good.</p>
  
  <p>The problem I have is when it comes to writing. I can not append text to a new line in the document. This is the script I got:</p>
  
  <pre><code>var fso = new ActiveXObject("Scripting.FileSystemObject"); 
  var s = fso.CreateTextFile("./ClassList.csv", true); 
  s.WriteLine("helloworld"); 
  s.Close(); 
  } 
  </code></pre>
  
  <p>The problem with this script is that it replaces all the existing text with "helloworld". What I want is to write "helloworld" in new line. Any solution for that?</p>
  
  <p>Also, is there any way to edit a specific line, like replacing all text in line x?</p>
  
  <p>Here are the scripts for download so that you can test them : <a href="http://ge.tt/7u5bDAV2/v/0" rel="nofollow">http://ge.tt/7u5bDAV2/v/0</a></p>