Carriage return inefficiency in a textarea control

Giganews Newsgroups
Subject: Carriage return inefficiency in a textarea control
Posted by:  pa… (Patrick)
Date: 23 Sep 2003

I'm developing an application which requires
a textarea to display large amounts of data.
I'm storing the information in an array and then
using join to dump the contents into the textarea.
It appears, however that textareas don't handle
carriage returns very well as illustrated by the following code.
If would appreciate if anyone knows the reason for this behavior
and a possible workaround.

    var arr= new Array;
    function GenString(s){
        for (var i=0;i<5000;i++)
            arr[arr.length] = i + ' = [abcdefghijklmnopqrstuvwxyz]'
        var d = new Date();    
        if (s=='||')form1.textarea1.value=arr.join('||')
        else form1.textarea1.value=unescape(arr.join('
        var d1= new Date()
        alert((d1-d)/1000 + ' seconds' + '
' + 'Textarea length= ' +
<FORM NAME="form1">
  <TEXTAREA ROWS="10" COLS="40" NAME="textarea1"></TEXTAREA>
  <BR><INPUT TYPE="button" VALUE="Generate || string" NAME="button1"
  <INPUT TYPE="button" VALUE="Generate
string" NAME="button1"