VBScript

Definition of VBScript in The Network Encyclopedia.

What is VBScript?

VBScript stands for Visual Basic Scripting Edition, a scripting language developed by Microsoft and designed primarily for use in Web browsers such as Microsoft Internet Explorer. VBScript is a lightweight subset of the more powerful Visual Basic for Applications (VBA) programming language used in Microsoft Office and other Microsoft development platforms.

VBScript omits features such as file I/O and direct access to the operating system to provide a secure scripting platform for developing Web-based applications using technologies such as Active Server Pages (ASP). Internet Explorer includes a scripting engine for interpreting and running scripts written in VBScript. VBScript can run on all versions of Microsoft Windows as well as on certain UNIX platforms.

How It Works

You cannot use VBScript to write stand-alone programs. Instead, you must embed script into standard Hypertext Markup Language (HTML) files. The script is executed when a Web browser opens the HTML file. Alternatively, ASP can use VBScript to generate client-side script on the fly.

Script within an HTML page is enclosed within <SCRIPT> … </SCRIPT> tags. For example, the following HTML segment displays a button that, when pressed, displays a message box that reads "Hello World!":

<INPUT TYPE=BUTTON VALUE="Click me"
NAME="BtnHello">
<SCRIPT LANGUAGE="VBScript">
Sub BtnHello_OnClick
MsgBox "Hello World!", 0, "An active document"
End Sub
</SCRIPT>

In this code, the <INPUT> tag creates the command button and the <SCRIPT> tag contains the script for the event handler that handles the button click.