title: How can I write data in a single line on text file using javascript
body: <p>I am trying to write data in a .txt file using JavaScript function.
  <strong>My function :-</strong></p>
  
  <pre><code>function WriteToFile()
  {
      var fso = new ActiveXObject("Scripting.FileSystemObject");
      var s = fso.CreateTextFile("test.txt", true);
      for(var j=1;j&lt;9;j++)
      {
          if(document.getElementById('chk'+j).checked)
          {
              s.WriteLine('  ');
              s.WriteLine(document.getElementById('item'+j).innerText);
              s.WriteLine(',');
              s.WriteLine(document.getElementById('txtBx'+j).value);
              s.WriteLine(',');
              s.WriteLine(document.getElementById('txtBxx'+j).value);
              s.WriteLine(';');
          }
      }
      alert("written");
      s.Close();
  }
  </code></pre>
  
  <p>Now the problem is that data being written on a new line.
  (maybe because i am using s.WriteLine ?)
  I want all the data to be written in a single line. how can i achieve this?</p>
  
  <p>to elaborate more, my current output looks like this </p>
  
  <pre><code>abc
  ,
  1
  ,
  cdf
  ;
  
  def
  ,
  3
  ,
  ehi
  ;
  </code></pre>
  
  <p>I want it like this-</p>
  
  <pre><code>abc,1,cdf;def,3,ehi;
  </code></pre>