ASP Syntax

Since ASP will permit you to decide the syntax you build up with you will to define this to allow the interpreter to know what language you are using. I have not observed an ASP page fail devoid of this but it's good practice to add it. At the top (first line) of you ASP page you show add:


<@ LANGUAGE="VBSCRIPT" %>

or
<@ LANGUAGE="JSCRIPT" %>

Basic Syntax:

The ASP.DLL is purposely looking for code that is put in between <% and %>. Any text amid these designators will be parsed by this DLL as code. You are able to mix and match this code.

Example (exampleA.asp):

<@ LANGUAGE="VBSCRIPT" %>

<HTML>
<TITLE>HEY THIS IS ASP!</TITLE>
<BODY>
<CENTER>HEY THIS IS ASP!
<BR>
<% Response.Write("I'm going to learn ASP ASAP!") %>
<BR>
All Finished!</CENTER>
</BODY>
</HTML>


The first four lines are normal HTML. Line five is where the ASP code starts (note the "<%"). Here an object was put in. The Response.Write object permits text (or HTML code) to be accepted back from the server to the client.

Comments:

To write a comment in VB all you have to do is add a single tick inside of an ASP code segment.

Example (exampleB.asp):

<@ LANGUAGE="VBSCRIPT" %>
<%
'This is a comment.
'Nothing after a tick will be seen by the user
'as it is not processed
'by the server.
%>

Note: We did not employ any HTML code. Loading this page will generate a valid HTML page, though, in practice you should forever use the HTML, TITLE, and BODY tags when making a page that will show output to a user. Pages that will redirect a user, etc. will not need these tags.





Copyright © 1999-2003. Maxis Media Studios, LLC All Rights Reserved.
Montreal Web Design - Maxis Media