How to write input to a file?

L

Lad

I would like to show a dialog window with one input field where a user
can fill in some data and this data ( from this one filed)will be
written to a file.
How can I do that in Javascript?
Thnaks for your help
Lad
 
M

McKirahan

Lad said:
I would like to show a dialog window with one input field where a user
can fill in some data and this data ( from this one filed)will be
written to a file.
How can I do that in Javascript?
Thnaks for your help
Lad

Where will the file reside?

If on the server then you'll need to use a technology like ASP (Active
Server Pages).

If on the clien't computer then you can use FSO (FileSstemObject) but it
will issue a security warning.

<html>
<head>
<title>fsoClient.htm</title>
<script language=javascript>
function saveData() {
alert(document.getElementById("Data").value);
var sFIL = "C:\\Temp\\fsoClient.txt";
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var oCTF = oFSO.CreateTextFile(sFIL, true);
oCTF.write(document.getElementById("Data").value);
oCTF.Close();
}
</script>
</head>
<body>
<form>
<b>Data :</b> <input type="text" name="data" size="50" maxlength="50">
<input type="button" value="Save Data" onclick="saveData()">
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top