logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Painting
Heart Disease
Horror Literature
Dating
Hiking & Backpacking
SF/Fantasy Books
Healthy Foods


dailyclick
All times in EST

Clairvoyance: 08:00 PM

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Formatting Text for HTML Display

Guest Author - Lisa Shea

A common task in ASP is to take a block of text from a database or user input, and put it on a webpage to be read. Make sure that you format it nicely!

Let's say you use either a SQL statement or a request from a form to get the value

UserComments

Let's say that UserComments is a long, long description that some user typed in about your product or website or favorite movie. Now you have this long description and want to show it on a browser page.

If you just say

response.write UserComments

you are going to get a GIANT block of text, all mashed together. That isn't going to be readable at all! Remember, HTML ignores simple hard returns. So all of that line break and paragraph break content that your user typed in will be lost.

Instead, use the REPLACE function to turn those line breaks into <BR> commands. HTML uses BR to determine when to move to the next line.

So the command would be

UserComments = Replace(UserComments, CHR(13), "<BR>")

Now all of those line breaks have been turned into actual BR entries. Your browser will then put line breaks in at those spots, and the content becomes nicely readable to your end users!

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.
This site needs an editor - click to learn more!

Add Formatting+Text+for+HTML+Display to Twitter Add Formatting+Text+for+HTML+Display to Facebook Add Formatting+Text+for+HTML+Display to MySpace Add Formatting+Text+for+HTML+Display to Del.icio.us Digg Formatting+Text+for+HTML+Display Add Formatting+Text+for+HTML+Display to Yahoo My Web Add Formatting+Text+for+HTML+Display to Google Bookmarks Add Formatting+Text+for+HTML+Display to Stumbleupon Add Formatting+Text+for+HTML+Display to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2013 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2013 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor