I'm trying to save input from a textarea to a .txt file.
Another textarea will be used for the name of the file
(example: important - it saves as important.txt
in a chosen directory)
What I've got so far:
<html>
<head>
<script language="javascript">
function WriteToFile()
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.CreateTextFile("C:\inetpub\wwwroot\myfile.txt", true);
var text=document.getElementById("TextArea1").innerText;
s.WriteLine(text);
s.WriteLine('***********************');
s.Close();
}
</script>
</head>
<body>
<form>
<div>
<textarea id="TextArea1" height: style="width: 588px; height: 90px" 90px">Write here</textarea><br />
<input id="Button1" type="button" value="Write" onclick="WriteToFile()"/>
</div>
</form>
</body>
</html>