ASP Syntax
If you have any experience with PHP, Javascript, or general programming then
ASP's syntax will make some sense to you. However, if you only have experience with
web technologies like HTML and CSS, then ASP will be more of a challenge.
ASP Syntax: Wrappers
Just how HTML uses tags to create web pages, ASP needs tags to create dynamic web sites. These tags
do not resemble the typical tags used in HTML, so be sure you notice the difference between
tags used for ASP and tags used for HTML. Below is the ASP script we used in the previous lesson.
ASP Code:
<html>
<body>
<%
Response.Write("Hello Me")
%>
</body>
</html>
ASP - Tags
These special tags <% and %> will always encapsulate your ASP code. Some things
about the ASP tag that sets it apart from normal HTML tags:
- An opening ASP tag is <% while an HTML tag normally looks like <tagname>
- A closing ASP tag looks like %> while an HTML tag normally looks like </tagname>
- ASP code can occurr anywhere, even within an HTML tag opening tag like this:
ASP Code:
<a href="<% Response.Write("index.asp") %>">Home</a>
Display:
ASP Syntax - Script Dependent
Besides the ASP Tag wrapper, the rest of ASP's syntax is dependent on which scripting
language you are using in your ASP code. The default setting for ASP is VBScript, a scripting
language based off of Visual Basic. However, you can also use non-Microsoft scripting languages,
the most popular option being Javascript. The following two lessons will be talking about
coding ASP with the aide of both these scripting languages.
If you would like to learn VBScript you can check out our VBScript
Tutorial.
Found Something Wrong in this Lesson?Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time! |