java script cannot write to files, this is a good thing imagin what a hacker or virus could do if it could write to your hard drive from the web very easily. ah.
you could submit from the url.
window.location='http://yourpage.com/script.php?mytext=hello my name is bob';
or you could post it.
there is one other method but i cannot remember the function names maybe ill post them later..