Nuno Paquete wrote:
Hi > Is there a javascript question here?
Yes.
Like i said I've read in a book a function that do just that, but I don't
remember the name of the function, and that function is Javascript, I
suppose.
Any more ideas?
Nuno Paquete.
"and that function is Javascript" is only true if you are using server-side
Javascript to serve up the content from the database. The mechanism
(function) to change new line characters stored in a database into a <br> for
output as HTML depends entirely on the server-side technology being used.
Note we keep saying "server-side". If you are reading data from a database on
the server, and outputting that to the client as HTML, then you have some
sort of server-side technology available (Perl, PHP, JSP, ASP, ColdFusion,
etc).
The place to change a new line character stored in the database into a <br>
for display as HTML is on the server.
As an example only, if you were using server-side JScript (ASP), you might do
something like:
function newlineToBr(s) {
return s.replace(/\n/g, '<br>');
}
Then you'd use it in your code as:
<td><%= newlineToBr(fieldFromDatabase) %></td>
Other server-side technologies would involve slightly different syntax, but
the concept is the same.
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html