Forums

ASP

This topic is locked

Line Wrap in ASP or JavaScript?

Posted 20 Jun 2002 10:01:50
1
has voted
20 Jun 2002 10:01:50 gordon knapp posted:
If you have a forum such as this, the occasional little &$~~@* comes along and inserts a row of characters without hitting the enter key like this
gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg

This normally forces the table to scroll off to the right and the end result looks 'orrible!

So .... does anyone know of an ASP or JavaScript code that will take a long unbroken line and auto wrap it at, say, 150 characters?

Yes, there is the Line Wrapper code on JavaScript Resources, but I have yet to get it to work when posting info to the database.

Cheers
G

Replies

Replied 20 Jun 2002 16:37:50
20 Jun 2002 16:37:50 m m replied:
I'm having the same problem... I'm working on a website for a client and I need them to be able to upadte pages online without screwing up the formating.

Is there any way to line and paragraph format with asp?

right now i tell them to insert a "<BR><BR>" before a new paragraph.

any ideas?
Replied 25 Jun 2002 16:16:20
25 Jun 2002 16:16:20 Kristian Waagsboe replied:
Here's the solution:

Mark the dynamic text and click on the menu View->Code and Design

You should now see something like this:
<%=(YourRecordset.Fields.Item("YourField".Value)%>

Were going to add a bit of code to this one. Make it look like this:
<%=(YourRecordset.Item("YourField".Value).replace(/\n/g,"<BR>\n"%>

(Remember to replace "YourRecordset" and "YourField" with the matching fields in your db. This one is certainly ASP JS Compitable, and I haven't tested it with anything else
Replied 29 Jun 2002 10:16:32
29 Jun 2002 10:16:32 panpan panpan replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Here's the solution:

Mark the dynamic text and click on the menu View-&gt;Code and Design

You should now see something like this:
&lt;%=(YourRecordset.Fields.Item("YourField".Value)%&gt;

Were going to add a bit of code to this one. Make it look like this:
&lt;%=(YourRecordset.Item("YourField".Value).replace(/\n/g,"&lt;BR&gt;\n"%&gt;

(Remember to replace "YourRecordset" and "YourField" with the matching fields in your db. This one is certainly ASP JS Compitable, and I haven't tested it with anything else
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 29 Jun 2002 10:22:48
29 Jun 2002 10:22:48 panpan panpan replied:
Quote
hi friend
I was made the change but the wrap in .asp do not work.
here is my code
&lt;%= Server.HTMLEncode((rsReply1.Fields.Item("message".Value).replace(/\n/g,"&lt;BR&gt;\n"%&gt;


any idea????
Thanks
Replied 30 Jun 2002 17:14:47
30 Jun 2002 17:14:47 Kristian Waagsboe replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hi friend
I was made the change but the wrap in .asp do not work.
here is my code
&lt;%= Server.HTMLEncode((rsReply1.Fields.Item("message".Value).replace(/\n/g,"&lt;BR&gt;\n"%&gt;
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

All I can see is that you dont have two "" at the end. If you go through your code you might see that one is missing. Make it look like this: &lt;%= Server.HTMLEncode((rsReply1.Fields.Item("message".Value).replace(/\n/g,"&lt;BR&gt;\n")%&gt;. Then it should be right

Reply to this topic