Monday, March 22, 2010

ASP Basic Syntax Rules

Write Output to a Browser
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.
The response.write Command
The response.write command is used to write output to a browser. The following example sends the text "Hello World" to the browser:
Example


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


There is also a shorthand method for the response.write command. The following example also sends the text "Hello World" to the browser:

Example


<% ="Hello World!" %>



The example above writes "Hello World!" into the body of the document.
________________________________________

Using JavaScript in ASP
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"%>


<% Response.Write("Hello World!") %>


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