title: Writing data to a local text file with javascript
body: <p>I have created a procedure to write content to a text file in my local machine.</p>
  
  <pre><code>&lt;form id="addnew"&gt;
      &lt;input type="text" class="id"&gt;
      &lt;input type="text" class="content"&gt;
      &lt;input type="submit" value="Add"&gt;
  &lt;/form&gt;
  &lt;script&gt;
      jQuery(function($) {
          $('#form_addjts').submit(function(){
              writeToFile({
                  id: $(this).find('.id').val(), 
                  content: $(this).find('.content').val()
              });
              return false;
          }); 
          function writeToFile(data){
              var fso = new ActiveXObject("Scripting.FileSystemObject");
              var fh = fso.OpenTextFile("D:\\data.txt", 8);
              fh.WriteLine(data.id + ',' + data.content);
              fh.Close(); 
          } 
      }); 
  &lt;/script&gt;
  </code></pre>
  
  <p>This is working fine, and able to append my new data to the file.</p>
  
  <p>But I want to update a particular row CONTENT based on the ID which I am passing.<br>
  I searched a lot, but could not find any.</p>
  
  <p>How can update a particular row in the file based on the ID?  </p>
  
  <p>Note:- I am not using any server as such. I have a a html file (contains all the functionality) which I will be running on my local machine itself.</p>