Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] \n -> br and more


  • From: paul at novitskisoftware.com (Paul Novitski)
  • Subject: [Javascript] \n -> br and more
  • Date: Tue Mar 28 03:04:29 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