Hello,
Using js, I would like to write a single string of several phrases into a textarea such that each phrase is aligned in order, one above the other.
I tried a function that receives the string argument and splits it into an array. With a ‘for-loop’, elements of the array are assigned in turn to the textarea value. This gives me only the last element (‘GROUP BY room’) displayed , since it was the last assigned. My placing of a ‘+’, a break(“<br>”) or a newline(n) didn’t help.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
To get the idea, the following piece of script displays the string as broken, stacked, but not in the textarea where I want it:
$Statement = “SELECT all data,
FROM Departments,
WHERE grouphead = ‘Milo’,
GROUP BY rooms”;
function write2area(statement){
var Query = new Array();
Query = statement.split(/,/);
for(i=0;i<Query.length;i++){
document.write(Query[i] + “<br>”);
}
}
……………………………
Which gives the output (below the textarea):
SELECT all data,
FROM Departments,
WHERE grouphead = ‘Milo’,
GROUP BY rooms
If you could suggest a way to break and stack a sting in a textarea, I would be most thankful.
weblaser