Please visit our sponsors !
ASP Syntax
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.
Jump to: Top of Page
or HOME or
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
|