In PHP, can I use JS to input a number to a textarea without overwriting the value in the original textarea?

Source: Internet
Author: User
In PHP, can I use JS to input a number to a textarea, but it does not overwrite the value in the original textarea. I want to create a page for example. after entering a value in the text box below, click "add" to display the value in textarea. Then, enter the value in the text box and click "add". The second value is also displayed in textarea, with a line break between the two, the younger brother uses arrays to input a number to a textarea using JS, but does not overwrite the value in the original textarea.
I want to create a page, for example, enter a value in the text box below, click Add to display the value in textarea, and then click add in the text box, the second value will also be displayed in textarea. line breaks can be generated between the two. The younger brother uses an array. The problem is that I assign the entire array to textarea every time, is there a way to output data to textarea one by one? a line break is required between each value.



Var arr1 = new Array ();
Function arr ()
{

Arr1.push (document. getElementById ('B'). value );
Document. getElementById ('A'). value = arr1.toString ();
}
Script
Reference


 

   
 


------ Solution --------------------
Document. getElementById ('A'). value + = "\ n" + document. getElementById ('B'). value
------ Solution --------------------
Reference:
Reference: document. getElementById ('A'). value + = "\ n" + document. getElementById ('B'). value
Thank you for your advice. The problem has been solved.

It's late. lz is so fast. congratulations.
------ Solution --------------------
Don't forget to paste it to the moderator.
------ Solution --------------------
Points for seeing ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.