This message was edited by Josh Code at 2004-5-1 9:17:44
: Say you have a HTML Forms page and you want to take the data that is entered on that page and save it to the users hard drive, but in a comma delimited text file. Can JS be used for this?? If so, could someone provide some examples please??
You can write files to a person's harddrive. To deal with security problems, the viewer of the page will always be asked for permission to make the file, however.
JScript(something made by Microsoft) has a File object that you can use.
There are ActiveX objects to use. Click the link below for a reading example.
This object can also be used for writing files.
take a look at this too.
I tried it out with Netscape and Internet Explorer and it only worked for Internet Explorer.
Here is the code I used:
var TristateFalse = 0;
var ForWriting = 2;
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
file = myActiveXObject.GetFile("c:\\test.txt");
text = file.OpenAsTextStream(ForWriting, TristateFalse);