Results 1 to 3 of 3

Thread: changing text in html with asp.

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    44

    Post

    Hello,

    Gotta small question. I am trying to convert the output of a database query, objRec("positiondescription") into HTML.

    The database holds regular text, but is there an elegant
    way to turn linebreaks in <br>?

    I tried the HTML <pre> tag but I don't like the typewriter like font. It doesn't word wrap well, either.

    Thanks so much,
    Scott

  2. #2
    New Member
    Join Date
    Feb 2001
    Posts
    12
    Hi,

    You can use this:

    Code:
    Function toHTML(strText)
    
    Dim strHTML
    
    If IsNull(strText) Then
        strHTML = ""
    Else
        strHTML = Replace(strText, Chr(13), "<br>")
    End If
    
    toHTML = strHTML
    
    End Function
    Then to use it:

    Code:
    Response.Write(toHTML(objRec("positiondescription").Value))
    That should do the trick.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    44
    Works like a champ! Thanks so much...

    Scott

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