ASP Syntax
You cannot view the ASP source code by selecting "View source" in a browser, you will
only see the output from the ASP file, which is plain HTML. This is because the scripts
are executed on the server before the result is sent back to the browser.
In our ASP tutorial, every example displays the
hidden ASP source code. This will make it easier for you to understand how it works.
Examples
Write text with ASP
How to write some text with ASP.
Add some HTML to the text
How to format the text with HTML tags.
The Basic Syntax Rule
An ASP file normally contains HTML tags, just like an HTML file. However, an ASP file
can also contain server scripts, surrounded by the delimiters <%
and %>. Server scripts are executed on the server, and can
contain any expressions, statements, procedures, or operators valid for the scripting language you
prefer to use.
Write Output to a Browser
The response.write command is used to write output to a browser. The
following example sends the text
"Hello World" to the browser:
<html>
<body>
<%
response.write("Hello World!")
%>
</body>
</html>
|
There is also a shorthand method for the response.write command. The following
example also sends the text
"Hello World" to the browser:
<html>
<body>
<%="Hello World!"%>
</body>
</html>
|
VBScript
You can use several scripting languages in ASP. However, the default
scripting language is VBScript:
<html>
<body>
<%
response.write("Hello World!")
%>
</body>
</html>
|
The example above writes "Hello World!" into the body of the document.
JavaScript
To set JavaScript as the default scripting language
for a particular page you must insert a
language specification at the top of the page:
<%@ language="javascript"%>
<html>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>
|
Note: 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 is shipped with VBScript and JScript (Microsoft's implementation of JavaScript). If you want to script in another
language, like PERL, REXX, or Python, you will have to install script engines
for them.
Important: Because the scripts are executed on the server,
the browser that displays the ASP file does not need to support scripting at
all!
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |

|
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |

|
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Promote collaboration among coworkers in your organization through project workspaces where others can efficiently find information and work together |

|
Personalize your company profile by bookmarking and organizing favorite content, uploading assets, posting photos, blogging, and more |

|
Interact with features like tagging, flagging, wikis and ratings found in the Web 2.0 Toolbox |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide. Request an
INSTANT DEMO or download a
FREE TRIAL today. |
|