Results 1 to 2 of 2

Thread: Convert line breaks into HTML

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    Sussex, England
    Posts
    45
    I need to display some text from a database field on my web page, but i've noticed that any line breaks etc. are lost. I thought about putting the text into a text area as this seems to maintain the correct formatting but i don't like the way it looks on the page. Is there a way to somehow convert the line breaks in the text into valid HTML or something ?

    Thanks
    Ian.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Before displaying the text, you can replace all vbCrLf with <BR>:
    Code:
    <%
    Dim strText
    
    strText = Replace(RS.Fields("YourFieldName"), vbCrLf, "<BR>"
    Response.Write strText
    %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width