I want to write a .txt file using the javascript console in IE. I already have the strings that I would like to write on the file; so, what I would like to do is:
var refTab=document.getElementById("historymatch_tb0");
var ttl;
for ( var i = 0; row = refTab.rows[i]; i++)
{
row = refTab.rows[i];
for ( var j = 0; col = row.cells[j]; j++ )
{
WriteInFile (col.innerHTML);
}
}
What I don't have is the function WriteInFile because I triyed this:
function WriteInFile (a)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var filename = "c:\\Users\\Riccardo\\a.txt";
var f = fso.OpenTextFile(filename, 2, true);
f.WriteLine(a);
f.Close();
}
this doesn't works, The script doesn't give me errors but the file is empty and The console shows the word: undefined! Where is the problem? Thanks!