THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

ASP Syntax


All our examples shows the ASP code. This makes it easier for you to understand how ASP works.


ASP Uses VBScript

An ASP file can be an ordinary HTML file. However, an ASP file can also contain server scripts.

The default scripting language in ASP is VBScript.

VBScripts surrounded by <% and %> are executed on the server.

The response.write() method is used by ASP to write output to HTML.

The following example writes "Hello World" into HTML:

Example

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

</body>
</html>
Show Example »
Note VBScript is case insensitive. Both Response.Write and response.write will work.

Using JavaScript in ASP

To set JavaScript as the scripting language for a web page you must insert a language specification at the top of the page:

Example

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

</body>
</html>
Note JavaScript is case sensitive. Only Response.Write will work.

More Examples

There is an easy shortcut to response.write(). You can use an equal sign (=) instead.

The following example also writes "Hello World" into HTML:

Example

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

</body>
</html>
Show Example »

Adding HTML tags to text

Adding colors to text


VBScript Examples

Learn by examples!

Because the scripts are executed on the server, you can not view the code in a browser. You will only see the plain HTML output from ASP.

At W3Schools every example displays the hidden ASP code. This will make it easier for you to understand how it works.

VBScript Examples


VBScript Reference

At W3Schools you will find a complete VBScript reference.

VBScript Reference