nurseryboy
10-06-2002, 08:35 PM
Hey guys,
I just have a little question about keeping line breaks when processing text through javascript.
What my problem is, is, I have a link:
<a href="javascript:template('$template')">Use Template</a>
($template is text coming from a mysql database),
that when the user clicks on it, it inserts the text from the database into a textarea. That all works fine, but when it gets run through the javascript to be shown, it looses its line breaks. They are in the text when it comes from the database, and even show up if I view the html source. But for some reason, javascript doesn't seem to want to keep them.
What code do I need in the function template() to make it keep the breaks? (The form name is post, and the textbox name is dscp, if that may help.)
I am a total novice at javascript, so any help would be appreciated.
Thanks a lot for your time and help,
Matthew
I just have a little question about keeping line breaks when processing text through javascript.
What my problem is, is, I have a link:
<a href="javascript:template('$template')">Use Template</a>
($template is text coming from a mysql database),
that when the user clicks on it, it inserts the text from the database into a textarea. That all works fine, but when it gets run through the javascript to be shown, it looses its line breaks. They are in the text when it comes from the database, and even show up if I view the html source. But for some reason, javascript doesn't seem to want to keep them.
What code do I need in the function template() to make it keep the breaks? (The form name is post, and the textbox name is dscp, if that may help.)
I am a total novice at javascript, so any help would be appreciated.
Thanks a lot for your time and help,
Matthew