Export a Local Html form data to CSV using Javascript or VBscript -


i have created html form used local computer , want form data saved in csv file.

each time form submitted, should add line in csv file.

this needs run locally cannot use php or jsp.

any or idea appreciated.

i assume ie-only question (vbscript). if so, can use activexobject called filesystemobject.

javascript:

csv=[]; // collect form values array. function savefile(csv){ var fso,ostream; fso=new activexobject('scripting.filesystemobject'); ostream=fso.opentextfile('absolute_file_path',8,true); ostream.writeline(csv.join(',')); ostream.close(); return; } function readfile(path){ var fso,istream,n,csv=[]; fso=new activexobject('scripting.filesystemobject'); istream=fso.opentextfile(path,1,true); for(n=0;!istream.atendofstream;n++){ csv[n]=istream.readline().split(','); } istream.close(); return csv; } 

you can read more filesystemobject in msdn.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -