How can make text in a cell that has no spacing to be automatically "wrapped"?
I`m writing a shoutbox script for my site that will appear on a box like 140 or 150 px long. The problem is, when a user writes a word that has length more than the cell can fit (like "this_is_a_long_word_and_it_does_not_fit_in_the_cell" or "aaaaaaaaaaaaaaaaaaaaaaaa") the cell gets stretched messing all the other cells and tables. So, how can make that cell wrap text so text like this:
this_is_a_long_word_and_it_does_not_fit_in_the_cell
appears like this:
this_is_a_long_word_and
_it_does_not_fit_in_the_cell
//http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close) {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
Not sure if this is the entire piece of code required, but the mozedit script can be purchased at the website in the code for around 2 bucks U.S. - providing you want the word wrap that bad on your textareas.