Freelance Writing Jobs | Today's Articles | Sign In

 
Browse Sections

Introduction to VBScript


Introduction to VBScript

Introduction to VBScript

What is VBScript
VBScript stands for Visual Basic Scripting Edition. It is an interpreted script language from Microsoft basically intended to write dynamic interactive web pages . In general, script languages are easier and faster to code in than the more structured, compiled languages such as C and C++ and are ideal for smaller programs of limited capability or that can reuse and tie together with existing compiled programs.

History of VBScript
BASIC -  Beginners All-purpose Symbolic Instruction Code- was one of the first high level programming language . Microsoft corporation has provided a widespread use of BASIC (many programmers are still using  Quick Basic which combines simplicity and high efficiency). A worldwide "visualization" of  computers gave birth to Visual Basic for Windows Applications.  With the advent of  Internet and HTML, the development of active Web applications became available. Till 1996 JavaScript was the only language for this purpos. In 1996 VBScript has been derived from Visual Basic for active scripting. The version 3.0 of MS Internet Explorer has supported both  JavaScript and VBScript.    

From Basic to VBScript
A syntax of  Basic  is very similar to those of VBScript. For example, let us compare (while still without scrutinizing) a simple codes written in both languages for guessing some random number. In Basic code, a number is inserted from the keyboard, and the result is displayed on the screen.

10 CLS : RANDOMIZE
20 a = INT ( RND(1)*100+1 ) 
30 PRINT "Try to guess a number from 1 to 100"
50 INPUT v
60 IF a > v THEN PRINT "Your number is more" :
GOTO 40
70 IF a < v THEN PRINT "Your number is less" :
GOTO 40
80 IF a = v THEN PRINT "You did it!"
90 END

In VBScript code a number is input in the HTML element (text-entry field named "textbox" in the program). The result is displayed at the message window while pressing on the other HTML element (button named "but" in the program). 

<head>

<title> </title> <script language="vbscript"><!-- dim a dim v sub begin_onclick randomize a=int(rnd(1)*100+1) alert "Number is guessed" end sub sub but_onclick v = textbox.value v=cint(v) if a > v then alert "Your number is more" p = p + 1 end if if a < v then alert "Your number is less" p = p + 1 end if if a = v then document.write"<center>You did it!</center>" end if end sub --></script> </head> <body> <p><input type="text" name="textbox" size="20"></p> <p><input type="button" name="but" value="click when ready"></p> </body> </html>

The principle distinction between 2 codes is that VBScript inserted

The copyright of the article Introduction to VBScript in VB Script is owned by Maxim Karetnikov. Permission to republish Introduction to VBScript in print or online must be granted by the author in writing.

Go To Page: 1 2

Articles in this Topic    Discussions in this Topic