Can anybody give some sample code to read and write a file using JavaScript?
To create file try
function makefile(){
var fso;
var thefile;
fso = new ActiveXObject("Scripting.FileSystemObject");
thefile=fso.CreateTextFile("C:\\tmp\\MyFile.txt",true);
thefile.close()
}
Create your directory in the C drive because windows has security against writing from web e.g create folder named "tmp" in C drive.