Bookmark and Share

ASP Programming - VBScript

As was mentioned in the last lesson, ASP uses VBScript as its default scripting language. VBScript is similar to Javascript, a client side programming language used to add functionality through the <script> tag.

Advertise on

Read the following paragraph carefully!

VBScript, when used to program ASP converts it to server side scripting. Any given web page could be created from a combination of server side and client side scripting. The confusing part is this: You must use these client side scripting languages (Javascript, VBScript, etc) to program in ASP!

Below we have a simple ASP script programmed in VBScript and includes the necessary HTML as well. This is only server-side scripting.

Server Side ASP Code using VBScript:

Dim myString
myString = Date()
Response.Write("The date is: " & myString)


The date is:

If you already know VBScript or Visual Basic programming then you'll recognize Dim as Dimension, which is used to "dimension" variables. It is a good programming practice to "dimension" all your variables before you use them, as we did with myString in the above example.

Now that we have our ASP Code working, say that we wanted to use our ASP code along with some client side Javascript code. To keep it simple we are just going to use the Javascript write function and have our ASP Code fill in the Date. All the Javascript client code is in the default color, but ASP Server Side Code is in Red.

ASP Code with VBScript and Client Side Javascript Code:

document.write("The date is:<% 
Dim myString
myString = Date()


The date is:

If you just want to program in ASP you can disregard the above example if you find it confusing. Just remember that you can have client-side Javascript code and server-side ASP/VBScript code included in an ASP generated web page!

Programming ASP with VBScript

You should be able to follow along with our ASP tutorial with little or no VBScript knowledge, but just in case you want to know more or find some of the VBScript syntax or code confusing then you can check out our VBScript Tutorial.

Bookmark and Share

Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

Advertise Here

More Tutorials!
Microsoft Office Tutorials Artist Tutorials