Convert Text Line Breaks to HTML in Classic ASP

Textarea input can contain text line breaks such as vbCrLf. HTML does not display those text newlines as visible line breaks by itself, so trusted text can be transformed before display.

Replace CRLF with an HTML break

Replace(text_variable, vbCrLf, "<br>")

This corrects the old single-quoted '<BR>' example: in VBScript, a single quote begins a comment; string literals use double quotes.

Visitor-content safety: if text_variable comes from a user, HTML-encode it first and only then convert the encoded line breaks. Otherwise submitted HTML/script could be rendered by the browser.

The original textarea line-break demo is retained for reference. The same transformation is useful for displaying multi-line textarea content. See the HTML line-break tutorial and the PHP nl2br() tutorial for equivalent concepts.


ASP Home






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer