Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save input words into text file using JavaScript (Urgent)

Status
Not open for further replies.

Benbunny

Programmer
Mar 19, 2001
18
0
0
HK
Can anyone tell me how to save the words in Textarea of the form into a text file.

Thanks a lot!
 
<!--
It is possible to do this using ActiveX embedded into your JavaScript
It works but it brings up a window asking if you want to run the script because it might be UNSAFE

-->
<html>
<head><Script language=&quot;JavaScript&quot;><!--
function WriteToFile()
{ var filename = &quot;data.txt&quot;;
var fso = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);
if (fso.FileExists(filename)) {
var a, ForAppending, file;
ForAppending = 8;
file = fso_OpenTextFile(filename, ForAppending, false);
file.WriteLine(&quot;Hello Again&quot;);
} else {
var file = fso.CreateTextFile(filename, true);
file.WriteLine(&quot;HELLO&quot;);
}
file.Close();
}
//-------------------------------------------------------
function ReadFromFile() {
var fso, a, ForReading; ForReading = 1;
fso = new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);
file = fso_OpenTextFile(filename, ForReading, false);
var name = file.readline();
var password = file.readline();
file.Close();
}
//-------------------------------------------------------
-->
</Script>
<body>
<script>
WriteToFile();
</script>
</body>
</html>
 
Thanks Damian13,

I will try it. Thank you for your kindly help.

 
Bear in mind that this is an Internet Explorer only solution. <insert witticism here>
codestorm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top