The problem is, i want to save a text file (or anything) in the local system using javascript.
2 Answers
There is no practical real world way to create a local file. However if you want to to just store data locally then try these two methods.
The old way:
http://www.w3schools.com/js/js_cookies.asp
The new way:
http://diveintohtml5.ep.io/storage.html
Alternatively, you could create a file with php and serve it out to the user.
file://path to use it.