title: Javascript in html write to file
body: <p>I am trying to write to a file from an html form, however the write part of the javascript doesn't do anything.</p>
  
  <p>Only the validate part of the script seems to be working.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
  &lt;script LANGUAGE="JavaScript"&gt;
  function Write(input1, input2)
  {
      var fso =  new ActiveXObject("Scripting.FileSystemObject");  
      var s = fso.OpenTextFile("C:\\test.txt", true);
      s.WriteLine(input1 + "," + input2);
      s.Close();
  }
  
  function validateForm() {
      var x1=document.userform.pwd.value;
      var x2=document.userform.re_pwd.value;
      if (x2 == x1){
          Write(document.userform.user.value, document.userform.pwd.value);
      }
      else{alert("Passwords are not the same, Re-enter password");}
  }
  &lt;/SCRIPT&gt;
  
  &lt;head&gt;
  
      &lt;link rel="stylesheet" href="css/screen.css" media="screen" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div id="container"&gt;
  
          &lt;h2&gt;Create a new account &lt;?php echo "It works!"; ?&gt;&lt;/h2&gt;
          &lt;form id="form1" NAME="userform" METHOD="GET" ONSUBMIT="return validateForm()" ACTION=""&gt;   
  
              &lt;fieldset&gt;&lt;legend&gt;Create a new Account&lt;/legend&gt;
                  &lt;p class="first"&gt;
                      &lt;label for="username"&gt;Username&lt;/label&gt;
                      &lt;input type="text" name="user" size="30" /&gt;
                  &lt;/p&gt;
                  &lt;p&gt;
                      &lt;label for="password"&gt;Password&lt;/label&gt;
                      &lt;input type="password" name="pwd" size="30" /&gt;
                  &lt;/p&gt;
                  &lt;p&gt;
                      &lt;label for="repassword"&gt;Re-enter Password&lt;/label&gt;
                      &lt;input type="password" name="re_pwd" size="30" /&gt;
                  &lt;/p&gt;
  
              &lt;/fieldset&gt;             
  
              &lt;p class="submit"&gt;&lt;button type="submit" value="Submit"&gt;Signup&lt;/button&gt;&lt;/p&gt;          
  
          &lt;/form&gt; 
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>