the write method but with new lines??

Discussion in 'JavaScript' started by player123, Mar 28, 2007.

  1. #1
    hi. i have a little problem that i can not work out and i am hoping if u can solve it. i am trying to write to a text area using this piece of code for example.

    myForm.cyberPetDaily.value = (speak);

    but everytime i invoke this method to write on the text area the previous output gets deleted. i want them to appear one aftrer the other without deleting themselves, i tryed to put thr new line char at the end but it doesnt work. any suggestions?
    thank!!
     
    player123, Mar 28, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try adding a plus sign infront of the equal sign. +=
     
    nico_swd, Mar 28, 2007 IP
  3. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #3
    get the old content into a var like

    var old = myForm.cyberPetDaily.value;
    myForm.cyberPetDaily.value = old + "\n" + speak ;
     
    krakjoe, Mar 28, 2007 IP
  4. player123

    player123 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    wow it works thanks guys!! :))
     
    player123, Mar 28, 2007 IP