Introduction to VBScript
So you want to learn VBScript? You may already know a web language like HTML and you want to move on to something more interactive, or you may have heard about VBScript and are curious about it, or one of many other reasons. Whatever your reason(s) may be, VBScript is a great language to learn!
This tutorial focuses on:
- What you should already know
- What is VBScript?
- VBScript and Internet Explorer
- What can be done with VBScript?
What you should already know
Before studying VBScript, you should already have at least a basic understanding of HTML and/or XHTML. VBScript scripts are placed on webpages with HTML/XHTML tags and without knowing these tags, you will not know where and how to place VBScript scripts on a webpage. Check out our HTML tutorials and XHTML tutorials if you are not yet familiar with these languages.
What is VBScript?
VBScript is a scripting language used to provide dynamic and interactive content on webpages.
VBScript is short for Visual Basic Scripting Edition. VBScript is a lighter version of the Visual Basic programming language, and like Visual Basic, VBScript was developed by Microsoft.
VBScript and Internet Explorer
The most important thing to know about VBScript is that it is a proprietary language.
VBScript was designed by Microsoft to work in Internet Explorer and browsers based on Internet Explorer's engine such as Flashpeak's SlimBrowser.
VBScript code will NOT work in web browsers such as Firefox. Opera, Safari, and Chrome.
NOTE: VBScript is not supported in Internet Explorer 11 by default. To make VBScript work in IE 11, please read our VBScript for Internet Explorer 11 page. VBScript does work for all IE versions below IE 11.
Due to the proprietary nature of VBScript, it is not a very popular scripting language on the world wide web. Instead, many people prefer using languages that are not proprietary and run on a variety of web browsers.
What's the purpose of learning VBScript if it is a proprietary language and there are non-proprietary alternatives out there?
Here are some reasons:
- Internet Explorer is the most popular web browser - knowing how to write code specifically for it is a plus
- Browser specific code - There may come a time when you want to provide separate content on a webpage for users of a particular web browser
- Knowing another language - It's always good to know more. Even if you will use VBScript alot less than other languages, you still have knowledge of another web language
What can be done with VBScript?
- Interact with the user - For example, you can ask the user for their name and print a custom message with it on a webpage such as "Hello Roger!"
- Form validation - Validate data entered by the user. For example, you can check to make sure that certain fields in a form were actually filled out, or that a piece of data contains the required amount of characters
- Perform calculations - You can use VBScript to perform a range of mathematical calculations ranging from simple arithmetic to complex formulas
- Act upon events - Specify code to run when certain events occur. For example, when the user clicks a button you can instruct VBScript to display a message in an alert box
All this and much more can be done with VBScript!