Advertisements
RSS

Tag Archives: write

Write to a file using JavaScript


Use this function to write to a file using JavaScript

 

function WriteToFile(sMessage)
{
  try
  {
        var fso, s;
        fso = new ActiveXObject(“Scripting.FileSystemObject”);
        sFile = fso.OpenTextFile(“C:\\logs.txt”, 8);
        sFile.writeline(sMessage);
        sFile.Close();
  }
  catch(err)
  {
        var strErr = ‘Error:’;
        strErr += ‘\nNumber:’ + err.number;
        strErr += ‘\nDescription:’ + err.description;
        document.write(strErr);
  }
}

Advertisements
 
Leave a comment

Posted by on September 9, 2009 in Programming

 

Tags: , , , , , ,

 
%d bloggers like this: