faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 8 people (38%) answered Yes
Recently 3 of 8 people (38%) answered Yes

Entry

printing array elements in textarea using for loop javascript

Apr 8th, 2008 19:10
ha mo, Dave Clark, sriram mynenni,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sriram,
     The following is an example of dumping the content of an array 
into a textarea:
var ele = document.forms['formName'].elements['textareaName'];
ele.value = '';
var x, len = MyArray.length;
for (x=0; x<len; ++x)
{
    if (ele.value.length > 0)
        ele.value += "\n";
    ele.value += MyArray[x];
}
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com