VBScript
What
is VBScript?
- VBScript is a scripting language.
- A scripting language is an interpreted programming language.
- VBScript is based in part on Microsoft's programming language Visual
Basic
- While it doesn't offer the same functionality of Visual Basic, it does
provide a powerful tool that can be used to add interaction to web pages.
What
is VBScript used for?
- VBScript is used to give functionality and interaction to web pages.
- VBScript can be used for client-side scripting.
- If VBS is used for client side scripting, only Internet Explorer can interpret
it (down side). VBScript is a Microsoft technology that requires
Microsoft's IE.
- VBS can also be used for server-side scripting. This requires the use of a Microsoft web server such as Personal
Web Server (PWS), or Internet Information Server (IIS) and a packaging
such as Active Server Pages (ASP).
What can be done with
VBScript?
Interact
with the user - For example, you can ask the user for their name and print
a custom message with it on a webpage such as "Hello"
Form
validation - Validate data entered by the user. For example, you can check
to make sure that certain fields in a form were actually filled out, or that a
piece of data contains the required amount of characters
Perform
calculations - You can use VBScript to perform a range of mathematical
calculations ranging from simple arithmetic to complex formulas
Act upon
events - Specify code to run when certain events occur. For example, when
the user clicks a button you can instruct VBScript to display a message in an
alert box
VBScript
Variables
As with algebra, VBScript
variables are used to hold values or expressions.A variable can have a short name, like x, or a more descriptive name, like carname.
Rules for VBScript variable names:
- Must begin with a letter
- Cannot contain a period (.)
- Cannot exceed 255 characters
VBScript Sub Procedures
A Sub procedure:- is a series of
statements, enclosed by the Sub and End Sub statements
- can perform actions,
but does not return a value
- can take arguments
VBScript Function Procedures
A Function procedure:- is a series of
statements, enclosed by the Function and End Function statements
- can perform actions and can return a value
- can take arguments that
are passed to it by a calling procedure
- without arguments, must
include an empty set of parentheses ()
- returns a value by
assigning a value to its name
No comments:
Post a Comment