...

View Full Version : replace function



jerz
01-03-2004, 12:16 AM
I just want to replace all \n with <BR>. I have made this script:

function doText() {
var text=document.layout.text.value;
text=text.replace(/\n/g,"<BR>");
document.layout.text.value=text;
}

If I write

"test

test"

the script returns:

"test
<BR>
<BR>test"

So, it doesn't seem to get rid of the \n 's???

Willy Duitt
01-03-2004, 01:04 AM
And this:

"test
<BR>
<BR>test"

Once rendered will return:
"test

test"

.....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum