Latest web development tutorials

ASP syntax

In our ASP tutorial, each instance provide hidden ASP source code. This will make it easier for you to understand how they work.


Write output to the browser

ASP file normally contains HTML tags, just like HTML files. However, ASP file can also contain server scripts are delimiters <% and%> surrounded.

Server scriptexecuted on the server, it may contain a valid expression of your chosen scripting language, statements, procedures, or operators.

response.write command

response.write command to write the output to the browser. The following examples are transferred to the browser of a text: "Hello World":

Examples

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

</body>
</html>

The demonstration >>

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

Examples

<!DOCTYPE html>
<html>
<body>
<%
="Hello World!"
%>

</body>
</html>

The demonstration >>


Using VBScript in ASP

You can use several scripting languages ​​in ASP. However, the default scripting language is VBScript:

<!DOCTYPE html>
<html>
<body>
<%
response.write("Hello World!")
%>
</body>
</html>

Examples of the above written text "Hello World!" To the body portion of the document.


Using JavaScript in ASP

If you need to set JavaScript as the default scripting language for a particular page, you must insert a row at the top of the page description language:

<%@ language="javascript"%>
<!DOCTYPE html>
<html>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>

Note: Different with VBScript, JavaScript is case-sensitive!You have to write your ASP code uses a different case letters according to the needs of JavaScript.


Other scripting languages

ASP and VBScript and JScript (JScript is Microsoft's implementation of JavaScript) complex nature of the original. If you want to use other scripting languages ​​like PERL, REXX, or Python, you must install the appropriate script engine.


Examples

More examples

Add some HTML tags to text