...

View Full Version : writing the contents of a textbox to a file



hhatwipro
06-16-2004, 12:30 PM
Hi Folks,

I have created a webpage which has 2 textboxes and a button

named "Write".

When the user fills in some string to the text boxes and clicks

the 'Write' button, the contents of textboxes should be written into

the some local file named "values.js".

Does javascript support writing into files?

If yes, please give me some detailed information on this.

Thank you all

hhat

kwhubby
06-17-2004, 10:52 AM
Client side javascript can write to text files using ActiveX controls, this is a very limited way of doing this and causes security prompts but you can try something like this:

function save()

{var forWriting = 2;

var dataFile = "C://note.txt";

var ts;var fso =new ActiveXObject

("Scripting.FileSystemObject");

ts=fso.OpenTextFile

(dataFile,forWriting,true);

ts.Write(data.xml);

ts.Close();}

guowei1000
06-17-2004, 11:22 AM
imagine someone can load a page that can write files into ur computer :eek: .... scarely.....

kwhubby
06-18-2004, 10:42 AM
imagine someone can load a page that can write files into ur computer :eek: .... scarely.....
well you would have to give permision first for the page to write (unless maby your running unpatched IE)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum