[Javascript] js for inserting a \n every 80 chars?

Matt Murphy matt.murphy at thermofisher.com
Fri Dec 29 10:24:56 CST 2006


 
All, 
 
I'm very new to js, please forgive if this is a n00b question. 
 
I have a script that takes user input from a textarea and dumps it into
a <pre> element in a new table cell. The problem is if you type in a
long sentance with no breaks, the <pre> will not allow it to wrap, and
it'll make the table super wide. I'm wondering if there's a javascript
function that will allow me to insert a \n every 80 characters? 
 
alternatively, I can dump the text in to just the table cell, but then
carriage returns aren't recognized at all, even though the text will
wrap. Is there a javascript version of str_replace()? 
 
Is there somewhere I can go to look up javascript functions?
 
Thanks in advance,
 
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20061229/cd0f312d/attachment.htm>


More information about the Javascript mailing list