HOME

ASP Tutorial
ASP HOME
ASP Introduction
ASP Install
ASP Syntax
ASP Variables
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa

ASP Objects
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error

ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary

ASP Components
ASP AdRotator
ASP BrowserCap
ASP Content Linking
ASP Content Rotator

ASP Quick Ref

Examples/Quiz
ASP Examples
ASP Quiz Test

ADO
ADO Introduction

Resources
ASP Resources
Download XMLSpy here
Please visit our sponsors !

ASP Syntax

previous next

You cannot view ASP code in a browser, you will only see the output from ASP which is plain HTML. This is because the scripts are executed on the server before the result is sent to the browser.

In our school, every example displays the hidden ASP code. This will make it easier for you to understand how it works.


Examples

Write text
How to write some text into the body of the HTML document with ASP.

Text and HTML tags
How to format the text with HTML tags.


The Basic Syntax Rule

An ASP file normally contains HTML tags, just as a standard HTML file. In addition, an ASP file can contain server scripts, surrounded by the delimiters <% and %>. Server scripts are executed on the server, and can contain any expressions, statements, procedures, or operators that are valid for the scripting language you use.


The Response Object

The Write method of the ASP Response Object is used to send content to the browser. For example, the following statement sends the text "Hello World" to the browser: Response.Write("Hello World").


VBScript

In ASP it is possible to use different scripting languages. The default scripting language in ASP is VBScript, as in this example:

<html>
<body>
<%
response.write("Hello World!")
%>
</body>
</html>

The example above uses the response.write function to write Hello World! into the body of the HTML document.


JavaScript

To make JavaScript the default scripting language within a particular page, insert a language specification at the top of that page.

<%@ language="javascript" %>
<html>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>

Note that - unlike VBScript - JavaScript is case sensitive. You will have to write your ASP code with uppercase letters and lowercase letters when the language requires it.


Other Scripting Languages

ASP comes with VBScript and JScript, Microsoft's implementation of Javascript. If you want to script in another language, like PERL, REXX, or Python, you have to install scripting engines for them. 

Because the scripts are executed on the server, the browser that requests the ASP file does not need to support scripting.


previous next

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

Domain Name Registration
Domain Name
Registration & More!



Your own Web Site?

Read W3Schools
Hosting Tutorial



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

University Online
Master Degree
Bachelor Degree


Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search