How to write input to a file?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lad

    How to write input to a file?

    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
  • McKirahan

    #2
    Re: How to write input to a file?

    "Lad" <export@hope.cz > wrote in message
    news:81a41dd.04 11151119.201d33 14@posting.goog le.com...[color=blue]
    > 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[/color]

    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 (FileSstemObjec t) but it
    will issue a security warning.

    <html>
    <head>
    <title>fsoClien t.htm</title>
    <script language=javasc ript>
    function saveData() {
    alert(document. getElementById( "Data").val ue);
    var sFIL = "C:\\Temp\\fsoC lient.txt";
    var oFSO = new ActiveXObject(" Scripting.FileS ystemObject");
    var oCTF = oFSO.CreateText File(sFIL, true);
    oCTF.write(docu ment.getElement ById("Data").va lue);
    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="saveDa ta()">
    </form>
    </body>
    </html>


    Comment

    • Andrew Thompson

      #3
      Re: How to write input to a file?

      On 15 Nov 2004 11:19:56 -0800, Lad wrote:
      [color=blue]
      > 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?[/color]

      You cannot do that from the internet using Javascript.

      Though there may be a way to do it with a .HTA in IE only,
      but I do not know.

      --
      Andrew Thompson
      http://www.PhySci.org/codes/ Web & IT Help
      http://www.PhySci.org/ Open-source software suite
      http://www.1point1C.org/ Science & Technology
      http://www.LensEscapes.com/ Images that escape the mundane

      Comment

      Working...