Intro to VBScript v.1.0                                        

Other Sites>>

Syntax

Including VBS into HTML

To include the script into you HTML document there needs to be the script tag. You must specify the language as VBS or VBScript since the script tags default language is JavaScript.
Next you must hide the code from older browsers that don't understand VBS. You should care if they don't because if you don't hide your code the browser will dump all you nice code on to the document you created. It's not pretty. Hide any code with the <!--- Yada yada --> tag, placing code in between the yada's.
Example:

<SCRIPT LANGUAGE="VBS">
<!--Hide code from older browsers
Document.Write "Hi Mom"
//Stop Hiding-->

VBS Scripting Basics

VBS is not case sensitive. That means you can use upper or lower case to refer to the same variable, function or statement. However this encourages sloppy code and should be avoided. If you declare myVar = 10; then don't refer to it any differently later on, such as MyVar;.

Use comments to make your code more readable. You can use either the ' or REM. Please note that when you use REM after a statement it must be preceded by a colon.
Example:

Document.Write "String" :REM this is my comment
REM this is my other comment
Document.Write "String2".

Create short code lines. This will make your code easier to read and debug. VBS includes a cool tool that links together two separate lines so when the code is interpreted it is treated as one. Use the underscore character preceded by a space at the end of the line to connect to the next line
Example:

VBS code line1 _
VBS code line2

Variables
-The name must be unique within its procedure.
-They must start with an alphabetical letter.
-They cannot be VBS reserved words.
-They cannot include either a space or a period.
Example

DIM Country
DIM Price
Country = "Canada"
Price = 59

Constants
The same as variables except, their values remain the same(duh). It is a good habit to type your constants in uppercase letters.

Declaring Variables and Constants
It is not required but it is a good idea to explicitly declare all your variables and constants at the top of your program using the DIM statement. Also to enforce this rule type
OPTION EXPLICIT at the top of your program so that it is easier to debug.
Example

<SCRIPT LANGUAGE="VBS">
<!--Hide from Older browsers
OPTION EXPLICIT
DIM PARENT1
DIM PARENT2
DIM feeling
PARENT1 = "Mom"
PARENT2 = "Dad"
feeling = "Good"
Document.Write "Hi "+PARENT1+PARENT2+ _
"How are you both? Im doing "+feeling
<//Stop Hiding-->
</SCRIPT>