- The Fundamentals of VBScript
- VBScript Versus VB
- Creating Variables in VBScript
- Concatenating Strings
- Arrays and Loops
- Resizing Arrays
- Inequality Operators
- Conditional Statements
- Select Case Statements
- Sub
- Function
- Working with Arguments
- Beware of Types
- Event Procedure Naming Syntax
- Server-Side Events
- Local Variables
- Script-Level Variables
Server-Side Events
This book is about ASP, therefore; most of the event procedures that you'll create in your scripts will be those that you program in response to server-side events. Luckily there are not as many events on the server side as there are on the client side. Actually, there are only two events that will take the bulk of your attention. One event is the Start event; the other is the End event.
The Start event is fired when an ASP Application or an ASP Session begins. The event procedures that you program are Session_OnStart and Application_OnStart.
The End event is fired when an ASP Application or ASP Session ends. You program the Session_OnEnd and Application_OnEnd event procedures. You'll learn more about the Application and Session objects later in this book. For now, the important thing to know is that IIS does fire events and that you can program server-side script to capture these events.
The Application and Session Objects
The Application object is an ASP construct that encompasses all the Web pages that make up your ASP application. The Application object allows you to treat each Web page as a part of a larger program.
The Session object allows you to keep track of a given user's activities between pages.
VBScript supports variable scope. This means that the lifetime and visibility of a variable depends on the place in code in which you create it. Support for scope allows you to give different variables the same name and not have to worry about name collision if the variables are of different scope. Being able to give common names to variables with different scope promotes code reusability. You don't have to spend a lot of time worrying about a preexisting name for a variable you are about to create. It doesn't matter as long as the variable in not in the same scope.