This section will provide you with the basics of what VBScript is, and why you would use it.
- Interpreted programs versus Compiled programs
- Why VBScript?
- What you can use VBScript for
- About VBScript
Before we start discussing the differences between interpreted and compiled, we have to define the term source code, more commonly referred to as code. The code is the plain text commands that the program is written in. All programming languages start out as source code; it is then either interpreted or compiled. The code that you will create in this course can be considered source code.
Interpreted programming languages tend to be simpler to program but slower to execute in general. Each time a program is run, it has to be interpreted (interrogated) line by line, based on the flow of execution (you will see later how branches and loops affect the flow of execution).
Compiled programming languages have a more complex syntax, and require more strict programming practices. With a compiled programming language, you first write the source code, then you feed it to a compiler (a special computer program), which produces an executable binary program. On the Windows platform, the output of the compiler usually ends in the ".exe" file extension. The program that comes out of the compilation process tends to be platform (operating system) specific. The key benefit for the programmer is that no other programmer can look at the source code once it is compiled. The other key factor is that the language used to write the source code becomes irrelevant once it has been compiled.
Visual Basic is a compiled language, whereas VBScript is an interpreted language.
Why Learn VBScript
VBScript is used to create Active Server Pages (ASPs), to create administration scripts for Windows 95/98/NT, to extend or enhance the functionality of the Microsoft Office products (like Word and Excel (macros)). It can also be used as a client side scripting language for Internet Explorer. Netscape does NOT
support VBScript as a client side scripting language.
VBScript is an interpreted programming language that can be embedded into an HTML web page or used in server side scripting.Client Side Scripting VBScript code is executed/interpreted when an event is triggered. When the code is executed it is interpreted one line at a time. There are a number of events that will trigger the execution of a VBScript, like clicking on a form button, or the completion of a web page loading. Note: Internet Explorer is the only browser that supports VBScript today.
Server Side Scripting
When the web server loads an .asp page from the disk into memory, it automatically knows to interpret the code in this document. Once the code has been interpreted, the resulting HTML page is sent to the browser (client) making the request.