about clearing text form text area

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • high
    New Member
    • Aug 2007
    • 2

    about clearing text form text area

    hi,
    im new to this platform, i have been creating a web page using MS Front page and i need to insert a text area to give the input and another text area to store that,

    [HTML] <form name="myform">
    <div style="left: 456; top: 803; width: 707; height: 59; position: absolute">
    <table border="0" cellspacing="0" cellpadding="5" ><tr>
    <td><textarea name="inputtext " rows="1" cols="20"></textarea></td>
    <input type="radio" name="placement " value="append" checked> Add to the text area<br>
    <td><p>&nbsp;<b r>
    <input type="button" value="Add New Text" onClick="addtex t();"></p>
    </td>
    <td><textarea name="outputtex t" rows="1" cols="20"></textarea></td>
    </tr></table>


    </form>


    <script language="javas cript" type="text/javascript">
    function addtext() {
    var newtext = document.myform .inputtext.valu e;
    document.myform .outputtext.val ue += newtext;
    }
    </script>
    [/HTML]
    but now i want to clear the text in the input text area to freashly enter another text, and the text should be entered ina separate line........... ..

    can any one plzzzzzzzzz help me regarding the code........... .....
    plzzzzzzzzzzzzz z
    Last edited by acoder; Aug 18 '07, 12:16 PM. Reason: Code in tags
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    i have been creating a web page using MS Front page
    FrontPage is such a bad program even Microsoft dropped it. Notepad is better than FrontPage :)

    Validate and fix your list of html errors.

    This "plzzzzzz" stuff really gets on some mods nerves.

    This is a javascript issue so I'm sending you there.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by high
      but now i want to clear the text in the input text area to freashly enter another text, and the text should be entered ina separate line........... ..

      can any one plzzzzzzzzz help me regarding the code........... .....
      plzzzzzzzzzzzzz z
      Welcome to TSDN!

      Please post code using CODE tags. Thanks!

      To clear the first textarea, just set its value to the empty string. Do this on line 20 of your code in your post.

      To enter text on separate lines in the second textarea, add a newline '\n'.

      Comment

      • high
        New Member
        • Aug 2007
        • 2

        #4
        Originally posted by acoder
        Welcome to TSDN!

        Please post code using CODE tags. Thanks!

        To clear the first textarea, just set its value to the empty string. Do this on line 20 of your code in your post.

        To enter text on separate lines in the second textarea, add a newline '\n'.
        hi,
        sory i did not get u!
        if i go to the 20th line im entering in to the script so where shall i give it?
        and second thing is where should i give the '\n' , because if im giving it after the output text im getting the entire thing being viewed in web page so help me regarding this . im fully novice to this ............... plzzzzzzzzzzz

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Originally posted by high
          hi,
          sory i did not get u!
          if i go to the 20th line im entering in to the script so where shall i give it?
          and second thing is where should i give the '\n' , because if im giving it after the output text im getting the entire thing being viewed in web page so help me regarding this . im fully novice to this ............... plzzzzzzzzzzz
          I meant the 20th line in the code that you posted. Try this:
          [CODE=javascript]function addtext() {
          var newtext = document.myform .inputtext.valu e;
          document.myform .outputtext.val ue += newtext + "\n";
          document.myform .inputtext.valu e = "";
          }[/CODE]

          Comment

          Working...