title: Using Javascript to Create a XML Document from a HTML Form
body: <p>I'm having a lot of difficulty with this project. 
  My aim is to write the results of a HTML form to an XML Document using Javascript.I have absolutely no idea how to do it. </p>
  
  <p>Reason why I'm coming here is that I want to be sure that I'm on the right track. So far, I'm writing only one line "\n" just to test things out.</p>
  
  <p>Here is my current JavaScript</p>
  
  <pre><code>var xhr = false;
  if (window.XMLHttpRequest)
  {
  xhr = new XMLHttpRequest();
  }
  else if (window.ActiveXObject)
  {
  xhr = new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  function StoreRegXml()
  {
  xhr.open("GET", "php.php?" + Number(new Date), true);
  xhr.onreadystatechange = getData;
  xhr.send(null);
  }
  
  function getData()
  {   
  if ((xhr.readyState == 4) &amp;&amp; (xhr.status == 200))
  {
      var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
      var fso = new ActiveXObject("Scripting.FileSystemObject");
      var filename = "customer.xml";
      var file = fso.CreateTextFile(filename, true);
      file.WriteLine('&lt;?xml version="1.0" encoding="utf-8"?&gt;\n');
      file.Close();
  }
  }
  </code></pre>
  
  <p>Am I on the right track?</p>
  
  <p>Edit: I'm adding alerts('test1'); to see where the code is going wrong and it stops at</p>
  
  <pre><code>var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  </code></pre>
  
  <p>Any ideas?</p>