From this question, this ...
lines = foo.value.split(/\\r\\n|\\r|\\n/);
is one way to split a string, but how do I join it back with newlin
As said, join is the best, but here is the hard way (untested, I hope it's not too trivial):
var result; for (i=0;i