Results 1 to 4 of 4
  1. #1
    new_Java is offline Member
    Join Date
    Feb 2011
    Posts
    5
    Rep Power
    0

    Default Save the text into a file

    Hi All,
    I need help with the Javascript this time, where if the user types in a msg in the textArea box, the text has to be stored in the file without prompting the user.
    Currently, with my approach, the text will saved into a text file by prompting the user.
    Here's the part of my code:
    ==========
    <script type="text/javascript">
    function test(){
    var jtext = document.getElementById("myTextArea").value;
    }
    </script>
    <textarea id="myTextArea" rows="5" cols="20">

    </textarea>

    <br>
    <br>

    <button onclick="javascript:document.execCommand('SaveAs', '1','fileName.txt');">Click to save</Button>
    ===========

    Any guidance would be truely appreciated. Thank you all:)

    Regards,
    NewBie

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    JavaScript is to java as ham is to hamster.

    Entirely different languages, you would probably get more help on a java script forum.

  3. #3
    new_Java is offline Member
    Join Date
    Feb 2011
    Posts
    5
    Rep Power
    0

    Default

    Okay..sure. Thank you.

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,784
    Rep Power
    7

    Default

    Although this is not Java, I have to question your design. When should the code save to the file? How do you know when the user will stop typing into the textfield?

Similar Threads

  1. Replies: 7
    Last Post: 08-17-2010, 06:00 PM
  2. GUI: How to save these data to a text/dat file?
    By florachu2121 in forum New To Java
    Replies: 6
    Last Post: 08-01-2010, 11:31 PM
  3. Edit/Save Text File - Problems
    By ryanlbowen in forum New To Java
    Replies: 9
    Last Post: 07-20-2009, 05:23 PM
  4. save text into xml in java
    By Omarero in forum New To Java
    Replies: 8
    Last Post: 10-26-2008, 02:19 AM
  5. Simple: Text to an image & save.
    By cilaes in forum Java 2D
    Replies: 4
    Last Post: 09-06-2008, 06:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •