[Javascript] \n -> br and more
Paul Novitski
paul at novitskisoftware.com
Tue Mar 28 03:04:12 CST 2006
At 12:38 AM 3/28/2006, Michael Borchers wrote:
>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.
Michael, this seems like a server-side script issue, not a JavaScript
issue. What language are you using? PHP?
Perhaps you could escape the backslashes in your database:
DBTEXT\\nNEXT ROW\\nANOTHER
to output:
...text.value = 'DBTEXT\nNEXT ROW\nANOTHER';
Paul
More information about the Javascript
mailing list