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

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

new
Journals
Folklore and Mythology
Business Coach
Marriage
Senior Living
Ethnic Beauty
Adolescence


dailyclick
All times in EST

Full Schedule
g
g ASP Site
Editor Wanted
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!

RSS | Related Articles | Previous Features | Site Map

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


Content copyright © 2009 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


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

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

jobs
what
job title, keywords
where
city, state or zip
jobs by job search


vote
Growing a Garden
Veggies and Flowers
Veggies Only
Flowers Only
No Garden

g


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


BellaOnline Editor