Telling Stories in VBScript
An arm of Visual Basic for the Internet!
-----------------------------------------------------------------------------------
-------------------------------------------------
Intended and built for the Internet, VBScript is a second generation offspring of Visual Basic. It has fewer language elements than Visual Basic and has been deprived of the Visual Basic Design Time capability. Like most programs, it only has a Run Time competence. There is one other significant difference: it can't compile. Rather, it depends on an Interpreter to convert each instruction to machine code prior to its execution, reverting to BASIC in that respect. By virtue of its genealogy, though, VBScript is compatible with its family members, which is to say that its blocks of code can be implanted in Visual Basic programs almost without change.
---------------------------------------------
VBScript and HTML are separate development systems and each is capable of generating objects for a Web page. That said, both VBScript and HTML are object-oriented, event-driven scripting languages, so they are highly compatible systems, and VBScript is well suited to augment HTML script.
To use Mary Jane Mara's words, "you increase your ability to manipulate HTML-created objects and their associated events by at least an order of magnitude." VBScript covers a "broader territory of browser-generated objects and events."
For HTML, the objects include, among others, such items as:
Further, for HTML, events are generated by clicking on the links created by the <ANCHOR> tags. When this occurs, an unload event is executed and is followed by a load event to bring in the new page. Here, the user may, for example, click on an input button after typing data into the text field of a form, thereby generating a submit event. This action, in turn, may trigger a computation. Events similar to these characterize Visual Basic, as well.
--------------------------------------------
To specify a hierarchy of objects is to define the scope (influence) of each object and the place each object occupies in the order of things for a program environment. Communication in the hierarchy flows from one object to another in only one way -- from top to bottom. Objects at the top have the broadest scope and can dictate to those below it. In VBScript, the order of the objects, roughly as presented by Mara, is as follows:
Window
Event
Strategy
Navigation
Location
Visual
Document
All
Applets
Body
Embeds
Frames
Images
Links
Plugins
Scripts
Selection
Forms
Elements
Button
Checkbox
Hidden
Image
Radio
Reset
Text
Textarea
Submit
Password
<object>
Select
Option
For details of the various objects in the hierarchy, see Mary Jane Mara's book.
---------------------------------------------
The Properties of VBScript are much as discussed in Visual Basic. Objects are programmed things that go on the monitor display. They are visuals, coming in different sizes, colors, and shapes, and make up different pieces of information used to display or identify the objects -- clusters that I've identified in general as repositories of information.
Mary Jane Mara points out that "all of the arguments ... used to set the properties of HTML tags are also available as properties in VBScript, and almost always have the same name." Some of the properties that she identifies are Action, AppName, Hash, Host, Length, Method, Name, Status, Title, Top, and Value.
---------------------------------------------
Methods are preprogrammed sets of actions tied to objects and so are similar to properties. The difference is that properties inform the objects, whereas methods are performed on or by the objects, as Mary Jane Mara explains. The blocks of code for the actions are attached to their respective objects and executed when the objects are clicked. This is the case with Visual Basic and objected-oriented programs, generally.
An example of a simple method is one called Open, which is attached to the window object and is used to open new windows in the user's browser. The block of code for the method is called upon to do its job whenever the windows open method is invoked by script.
Methods needn't be the sole property of any single object. They might, rather, be attached to multiple objects. The open method, for instance, is also attached to the document object, though it doesn't behave there as it does for the window object. Methods may or may not have arguments. With some methods, arguments are optional.
A sample of other methods identified by Mara are: Add, Alert, Back, Clear, Click, Close, Confirm, Duplicate, Focus, Go, Move, Navigate, Prompt, Remove, Reset, Stop, and Write.
----------------------------------------------
Some methods are more general and can be applied to more than one, if not many, objects. These methods are unattached to objects and are given the special name, functions. Among the functions are the standard mathematical functions, like the trigonometric sine and cosine functions, for example.
As methods without objects, functions are still stored procedures that might be run by calling the functions in the script. Aside from the fact that functions don't have objects, they also differ from methods in that they usually return a value that itself is acted upon internally by a script.
Among other functions presented by Mary Jane, there are: Abs, Array, Atn, Cint, Color, Date and Time, Filter, Int, IsEmpty, IsNumeric, Join, Len, Mid, Replace, Right, Round, Sgn, Space, Sqr, String, and Tan.
-----------------------------------------