Hi,
I would like to know if it is possible to use JavaScript to write to a text file. I tried using FileSystemObject in JavaScript. However, it gives the following error : "Automation server can't create object". Does anyone know what is going wrong here?
To give an overview of what I am trying to achieve here. There are 2 parts I need to do.
1) enable users read information from an XML file offline. I managed to user JavaScript to read
and display the necessary informatiom (for example : a quiz).
2) read quiz result from the page and write to a text file. Upon going online, there shall be a
function to read the result from the text file and update it into our DB.
2nd part is an issue to me now. If you think this is not feasible, could anyone suggest any other
ways to work around this?
Attached is the code for the 2nd portion :
==========================
==========
==========
==========
function WriteToFile() {
try {
var fso, s;
fso = new ActiveXObject("Scripting.F
ileSystemO
bject");
s = fso.CreateFolder("C:\\test
.txt", true);
s.writeline("This is a test");
s.Close();
}
catch(err){
var strErr = 'Error:';
strErr += '\nNumber:' + err.number;
strErr += '\nDescription:' + err.description;
document.write(strErr);
}
Thanks a lot....
Start Free Trial