Bookmark and Share

VBScript First Script

We like to teach by example, here at Tizag.com, so let's start off with a simple VBScript example that will help you get your feet wet. Reminder: We will not be explaining the HTML in this tutorial so review our HTML Tutorial if you ever need extra assistance understanding an example or lesson.

Advertise on Tizag.com

VBScript Script Creation

This first script will be very basic and will write "Hello World" to the browser window, just as if you had typed it in HTML. This may not seem very important, but it will give you a chance to see the VBScript Syntax without getting to complex.

VBScript Code:

<html>
<body>
<script type="text/vbscript">
document.write("Hello World")
</script>
</body>
</html>

Display:

Note: If you are not using Internet Explorer to view this tutorial then you will see nothing displayed. This is because VBScript only runs on Internet Explorer browsers! Just in case you don't have access to Internet Explorer we will be providing a converted output in the rest of our displays for this tutorial.

Display:

Hello World

VBScript <script> Tag

In the above example you saw the basic cookie cutter for inserting a script into a web page. The HTML script tag lets the browser know we are going to use a script and the attribute type specifies which scripting language we are using. VBScript's type is "text/vbscript".

All the VBScript code that you write must be contained within script tags, otherwise they will not function properly.

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