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
Creativity
Family Travel
Southwest USA
Irish Culture
Home Finance
Comedy Movies
Romance Novels


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Writing Output in ASP

Guest Author - Lisa Shea

One of the first things to learn in ASP is how to create output. With a few simple commands, you can write out the current date and time, the user's browser information, and much, much more!

How does this work? Well, remember, ASP itself isn't ever visible to the user, It works behind the scenes. ASP can, however, display regular HTML tags, and text, and other HTML commands to the user's browser. The user's browser then interprets them as regular HTML and displays them just as if you had hard coded that information into a page.

What do I mean? Well, say you wanted the words

Hello, World

to appear to someone coming to the page index.asp. Let's say you wanted to use ASP to display those words. First, you would start with the "starting ASP" indicator. You always use this before you give any ASP commands, so your browser knows that what is coming next shouldn't be shown to the user.

<%

The <% is the way the browser knows to switch to 'ASP mode' where it starts processing what you tell it to do. Now you want to give the ASP command to write out some text. So you would put:

Response.Write "Hello, World"

That line tells the ASP interpreter to take the text "Hello, World" and write it out to the browser. You end with the 'end of command' marker -

%>

and that's it! So your entire file, with the normal HTML starting and ending, would look like this:

<HTML>
<BODY>
<%
Response.Write "Hello, World"
%>
</BODY>
</HTML>

That's it, you've done your first ASP page! Wasn't that easy? But heck, if you were just going to write "Hello, World", you wouldn't need ASP to do it. The great part about ASP is that you can write ANYTHING ASP knows about, which includes results from calcuations, retrievals from database queries, and much, much more.

Let's say you have a page in which you have all sorts of other HTML, and then at one spot you decide you want to show the user the current date and time. You can't code that into a web page, because it's always changing! However, since ASP is interpreted as the page is being displayed, IT always knows what time it is. So instead of putting

THIS IS THE CURRENT TIME

you would put

<%
Response.Write Now()
%>

and when the program ran, it would show the current time! There are MANY applications for writing with ASP. Check out this site or the below ebook for samples.

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 Writing+Output+in+ASP to Twitter Add Writing+Output+in+ASP to Facebook Add Writing+Output+in+ASP to MySpace Add Writing+Output+in+ASP to Del.icio.us Digg Writing+Output+in+ASP Add Writing+Output+in+ASP to Yahoo My Web Add Writing+Output+in+ASP to Google Bookmarks Add Writing+Output+in+ASP to Stumbleupon Add Writing+Output+in+ASP 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 © 2014 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 © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor