We’ve now discussed all of the basic principles of structuring VBScript programs, of constructing subroutines that can be used by various parts of your program, of building functions that perform calculations and other manipulations and pass the result back to the calling part of the program, and of creating classes that allow you to encapsulate real-world processes and objects. The emphasis on subroutines, functions, and classes, though, raises another issue—that of code reuse. Typically, classes are defined so that they can be used in a variety of applications. Similarly, many subroutines and functions are intended not only to reduce code in a single application, but also to be “black boxes” that can provide some service to multiple applications.
Although it generally hasn’t been emphasized, and is dependent on the host platform, VBScript code can be reused on three of the four host platforms discussed here. The only platform that doesn’t support code reuse is Outlook forms. That means that if you’re scripting for WSH, ASP, or MSIE, you can develop code libraries that you import into your script.
You can import HTML, client-side
script, or server-side script into an ASP file by using the
server-side directive. Its syntax is:
PathType is one of the following
sFileName is relative path
from the current directory
sFileName is a full ...