posted 19 years ago
I am trying to write to a file but the execution gets stuck here
var fso = new ActiveXObject('Scripting.FileSystemObject');
DO you have any idea? Is there any other way one can write/append to a file.
function WriteToFile() {
alert('enter writetofile')
var filename = 'c:/sharadatemp.txt';
alert('enter writetofile 1')
var fso = new ActiveXObject('Scripting.FileSystemObject');
alert('enter writetofile 2')
if (fso.FileExists(filename)) {
alert('file already exists')
var a, ForAppending, file;
ForAppending = 8;
file = fso.OpenTextFile(filename, ForAppending, false);
file.WriteLine('Hello Sharada');
file.WriteLine('how are you');
}
else {
alert('create writetofile')
var file = fso.CreateTextFile(filename, true);
file.WriteLine('created file');
file.WriteLine('will write');
}
file.Close();
}
</script>