I've been searching for a while now for a solution to the firefox word wrapping issue.
I found a solution here @
http://javascript.abou t.com/library/blspline.htm
I followed the instructions exactly but I cannot get it to work. I am not a programmer and I am just wondering if this function is broken? I tried everything I can think of with document.write
I can't get any text to output or sometimes I get "undefined" as an output.
I've also tried like it says in the example:
<SCRIPT LANGUAGE="JavaS cript">
var myText40 = splitLine(myTex t,40);
var myHTML = myText40.replac e(/\n/g,'<br \/>');
</script>
But it nothing outputs. Can anyone help this newb here? Thanks in advance!
<SCRIPT LANGUAGE="JavaS cript">
// Line Splitter Function
// copyright Stephen Chapman, 19th April 2006
// you may copy this code but please keep the copyright notice as well
<!-- Begin
function splitLine(st,n) {
var b = '';
var s = st;
while (s.length > n) {var c = s.substring(0,n );
var d = c.lastIndexOf(' ');
var e =c.lastIndexOf( '\n');
if (e != -1) d = e; if (d == -1) d = n;
b += c.substring(0,d ) + '\n';s = s.substring(d+1 );
}return b+s;
}
// End -->
</script>
I found a solution here @
http://javascript.abou t.com/library/blspline.htm
I followed the instructions exactly but I cannot get it to work. I am not a programmer and I am just wondering if this function is broken? I tried everything I can think of with document.write
I can't get any text to output or sometimes I get "undefined" as an output.
I've also tried like it says in the example:
<SCRIPT LANGUAGE="JavaS cript">
var myText40 = splitLine(myTex t,40);
var myHTML = myText40.replac e(/\n/g,'<br \/>');
</script>
But it nothing outputs. Can anyone help this newb here? Thanks in advance!
<SCRIPT LANGUAGE="JavaS cript">
// Line Splitter Function
// copyright Stephen Chapman, 19th April 2006
// you may copy this code but please keep the copyright notice as well
<!-- Begin
function splitLine(st,n) {
var b = '';
var s = st;
while (s.length > n) {var c = s.substring(0,n );
var d = c.lastIndexOf(' ');
var e =c.lastIndexOf( '\n');
if (e != -1) d = e; if (d == -1) d = n;
b += c.substring(0,d ) + '\n';s = s.substring(d+1 );
}return b+s;
}
// End -->
</script>
Comment