title: Javascript Write to Textfile
body: <p>I'm trying to take input from a form and save it into a text file that is in the same folder as the html file. This is what I have so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
   &lt;meta charset="utf-8"&gt;
  
   &lt;title&gt;Reservation&lt;/title&gt;
   &lt;meta name="description" content="The HTML5 Herald"&gt;
   &lt;meta name="author" content="SitePoint"&gt;
  
   &lt;link rel="stylesheet" href="css/styles.css?v=1.0"&gt;
  
     &lt;script&gt;
    function writeToFile(item, name, time)
    {
     alert("Hello " + item);
     var fso = new ActiveXObject("Scripting.FileSystemObject");
     var fh = fso.OpenTextFile("E:/labChart/etc/reserve.text", 8);
     fh.WriteLine(item);
     fh.Close();
    }
  
    function readFile()
    {
     var fso = new ActiveXObject("Scripting.FileSystemObject");
     var fh = fso.OpenTextFile("reserve.text", 1, false, 0);
     var lines = "";
     while (!fh.AtEndOfStream) {
      lines += fh.ReadLine() + "\r";
     }
     fh.Close();
     return lines;
    }
   &lt;/script&gt;
      &lt;/head&gt;
   &lt;body&gt;
    Reservation
      &lt;br&gt;
      &lt;form&gt;
         Item:
         &lt;br&gt;
       &lt;input type="text" name="item" id="item"&gt;
       &lt;br&gt;
       Name:
       &lt;br&gt;
       &lt;input type="text" name="name" id="name"&gt;
       &lt;br&gt;
       Time:
       &lt;br&gt;
       &lt;input type="date" name="time" id="time"&gt;
       &lt;br&gt;
       &lt;br&gt;
       &lt;input type="submit" value="Submit" onclick="writeToFile(document.getElementById('item').value, document.getElementById('name').value, document.getElementById('time').value)"&gt;
    &lt;/form&gt;
      &lt;script src="js/scripts.js"&gt;&lt;/script&gt;
   &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This does take the info from "item" and pass it to the function writeToFile() because the test alert does work. But whenever I check the file reserve.text nothing is written there. I'm very new to javascript and most of this is an amalgamation of code I saw other people using online for similar effects. Does anyone know why it is not working? Am I writing the path incorrectly? Am I not writing the script correctly?</p>