About Me

Saturday, 21 April 2012

VBScript First Script

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.

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.

0 comments:

Post a Comment