Hi All,
VBscript is a programming language specifically used in Internet Explorer browsers. Client side VBScript is only supported by Internet Explorer. It is language developed by Microsoft.
Functions
To create a function, the syntax is as below:
function main()
' comments
' coding
end function
Functions is used to perform actions required by the user.
Example of actions are as below:
To display a value returned from the database
To execute SQL statements
To form HTML statements - display check box, text box on the screen
To perform calculations
To return data from the database
Variable Declarations
The declaration of variable using VBScript is as below:
dim a
dim a,b
Assigning Variables
After declaring variables, we can assign values to the variables.
The syntax for assigning variables is as below:
dim a
dim b
a = "First variable"
b = "Second variable"
Differences between VBScript and Javascript
Please note that there are several differences between VBScript and Javascript.
1. The syntax of creating function is different for VBScript and Javascript.
VBScript
function main
end function
Javascript
function testFunction()
{
}
2. Secondly, in VBScript, we can't assign variables using this method.
VBScript
dim a = "First variable"
Instead, we use this.
dim a
a = "First variable"
Instead, we use this.
dim a
a = "First variable"
Javascript
var a = "First variable" .
3. Declaration of variables
VBScript
We use the keyword, dim to declare a variable in VBScript.
Javascript
We are using the keyword var to declare a variable in Javascript.