About Clik  | abdi_issa@hotmail.com
Search
Home Somali Internet Software Downloads Education Books Join
HTML JavaScript VBScript SQL PL/SQL ASP Java C++
&nsbp; Click here to buy & sell on eBay!  Accept credit cards Now!
VBScript Basics
Introduction
Variables
Sub Procedures
Function Procedures
If Statement
Case Statment
loops
Operators
Form Validations
Alert, prompt, confirm boxes
Objects
Window Objects
 
VBScript Books
VBScript Books List

VB Script?

VBScript is a script version of visual basic supported by Internet Explore 3.0 and above. With VB Script, you can make your web site dynamic and interactive.  VB Script code is interpreted like Java Script by the browser and Visual Basic terms are used.  For example declaring a variable, writing sub, or function in VB Script is done like Visual Basic but keep in mind that Visual Basic is programming language for applications while VB Script is small script version coded with HTML documents.

To place VB Script with ASP or HTML document, use <script language = "vbscript">. With this term script tells the browser that the content from this tag to the end tag </script> to be interpreted as script language. We also inform the browser that this is a VB Script by setting the language equal to "vbscript". VB Script code can be placed in head or body section of any HTML document depend on the favored result. The head section is good place to insert any procedures while the body section is good place to execute the final results.


Here is an small example that defines a variable, uses input box to grab the users name, stores the user name in the defined variable and places it on the page.
<html>
<head>
<script language="vbscript">
  Option Explicit
  Sub GetUserName()
     dim name
      name=inputbox("Enter your name:")
     document.write("Your name is: " & name)
  end sub
</script>
</head>
<body>
 <script language="vbscript">
       call GetUserName()
 </script>
</body>
</html>
Do you remember when you get to this page, I asked your name?. That is what this vb script code does. Variable name was defined in the sub procedure GetUserName. Sub procedure is aware of whatever defined and evaluated in it. It does not return a value as the function does in vb script. Then the name variable was set to input box. This prompts an interface to the user and whatever user enters is stored back into the variable. Every sub must be closed with end sub. Option explicit catches any undeclared variables. It's good programming habit to declare all your variables. Finally, the sub is called. The expected result was to write the name on the browser.
Here is the result:
:

Variables & Arrays