View Single Post
Old 01-17-2013, 06:35 AM   PM User | #1
ssen6547
New to the CF scene

 
Join Date: Jan 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ssen6547 is an unknown quantity at this point
Javascript code to create a text file

<html>
<h2>Create Text file in JavaScript</h2>
<script>
function createFile(){
var object = new ActiveXObject("Scripting.FileSystemObject");
var file = object.CreateTextFile("C:\\Hello.txt", false);
file.WriteLine('Hello World');
file.WriteLine('Hope is a thing with feathers, that perches on the soul.');
file.Close();
}
</script>
<input type="Button" value="Create File" onClick='createFile()'>
</html>



This code doesn't work, it throws error
Uncaught ReferenceError: ActiveXObject is not defined
When opened in google chrome version 24.0.1312.52 m

Can anyone help on this.

Moto of this code is to create a text file with some content using javascript
ssen6547 is offline   Reply With Quote