[Javascript] \n -> br and more

Michael Borchers list at tridemail.de
Tue Mar 28 02:38:35 CST 2006


i have a databased text with \n tags and put them into a function like

...text.value = 'DBTEXT"...

but this DBTEXT has rows (\n), so js turns into:

...text.value = 'DBTEXT

NEXT ROW

ANOTHER';

and js creates an error for that string because it's breaking the source code.

so i chose php to replace \n with <br>:

text.value='DBTEXT<br>NEXT ROW<br>ANOTHER';

works fine, but now the DBTEXT which is parsed into a textarea shows the <br> tags
which isn't that nice.

workaround?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060328/2400db55/attachment.htm>


More information about the Javascript mailing list