For instance:
var a = " ";
var b = "";
b = a * 8;
alert(b +"this far to the right");
Note: I don't want to use   since ActiveX FSO will be used to write to a text file not html file. So it needs to be spaces only:
More thorough detail of what I'm trying to achieve:
I'm trying to get ActiveX FSO to write to a text file from an HTML order form once form is submitted it then proceeds to write up the order to a text file. The text file needs to be in certain format for Microsoft Dynamics to accept as an import sale.
Like this below shown as: customer code spaces item code spaces quantity spaces:
import.txt minus the string length with the slots = remaining spaces to fill.
C242299A *4 white spaces* 2890 *12 white spaces* 20 *6 white spaces*
[------------][----------------][--------]
12 char slots 16 char slots 8 char slots
write.js will create this import.txt file (this is the part I need help on)
var customercode = document.getElementById("customercode").value;
var itemcode = document.getElementById("itemcode").value;
var quantity = document.getElementById("quantity").value;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile(path+"import.txt",8,true,0);
//customer code string length must be measured to determine remaining spaces
//to fill before item code can be entered.
//you only have 12 character slots before the next string "item code" can be entered
var remainingSpaces = "";
remainingSpaces = 12 - customercode.length;
spacefill1 = " " * remainingspaces;
remainingSpaces = 16 - itemcode.length;
spacefill2 = " " * remainingSpaces;
remainingSpaces = 8 - quantity.length;
spacefill3 = " " * remainingSpaces;
s.WriteLine(customercode+spacefill1+itemcode+spacefill2+quantity+spacefill3);
Supposed to create a text file that looks like this:
C242299A 2890 20
which will then be imported to Microsoft Dynamics.
But problem is it doesn't multiply the spaces it regards the spaces as 0/null :( Jquery solution welcomed.