How do you print a Javascript string to a multiline text box?

Discussion in 'JavaScript' started by Brandon Tanner, Jul 3, 2008.

  1. #1
    Hey everyone,

    I have a simple HTML multiline textbox, and I want to use Javascript to get text that the user types into that box, and then I want to print that text in a different multiline text box. How would I do that?

    I've figured out how to get the value from the original textbox and write it on the screen, for example...

    document.write("Here is your text... <BR>" +
    window.document.formOne.userText.value);

    ...But I can't figure out how to print that value in *another* text box.

    Any help is greatly appreciated. Thanks!
     
    Brandon Tanner, Jul 3, 2008 IP
  2. =Messa=

    =Messa= Peon

    Messages:
    104
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello.

    Here I created an example solution for you.

    
    <html>
    <body>
    <form name="f">
    <textarea name="ta1"></textarea>
    <textarea name="ta2"></textarea>
    <button type="button" onclick="javascript:document.f.ta2.value=document.f.ta1.value">Copy</button>
    </form>
    </body>
    </html>
    
    HTML:
     
    =Messa=, Jul 3, 2008 IP
    Brandon Tanner likes this.
  3. Brandon Tanner

    Brandon Tanner Peon

    Messages:
    68
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you Messa! Works great :)
     
    Brandon Tanner, Jul 4, 2008 IP