One of the coolest features of VBScript is its capability to generate HTML on-the-fly.
You can use the programming capabilities of VBScript to decide what should appear on the page and how it should appear. Then the script code can output the HTML for display within the browser window.
In addition to using the onLoad event, you can embed VBScript code anywhere within your page's HTML. It is useful when most of your page based on static HTML, but you want to use VBScript code to display some HTML that changes with varying conditions.
A good example of this is displaying the current date on the page. You also can use this technique to embed different graphics and messages, depending on any variable information to which VBScript has access; time of day, type of Web browser the user is running, and even the history list that contains the last few pages the user visited.
The new document is started using the document.open method. It opens a new output stream with which you can write HTML text.
It also clears the document currently displayed in the browser. After this comes various document.writeln method invocations.
VBScript can be tied to CGI/ISAPI applications in both directions. First, the CGI/ISAPI application can generate an HTML document containing VBScript code.
Moreover, this code may depend on the data that was input into the CGI application.
Most Web servers provide the capability to launch applications from a Web page and pass the application information that entered onto the Web page. The application then produces some output page based on the data it received.
These applications usually are common gateway interface (CGI) or Internet Server API (ISAPI) applications. They must be written to accept input from the Web server and to return data to the server in the proper format.
It is possible to use VBScript to alter the way the Web page interacts with the CGI/ISAPI application. The script code could change the data before submitted to the application, for example.
It is useful when the server-side application is expecting a field to be in a specific format, but the Web page gives the user more flexibility in an entry. The script code then can interpret the entered data and format it properly for submission.
When the HTML form is submitted, VBScript code can be used to determine which entry selected in the list box.
VBScript code can also be used to submit the proper code value to the server application.
In addition to interacting with server-side applications using VBScript, you can interact with databases located on the Web server.
By using the Microsoft Internet Information Server (IIS) with the Internet Database Connector (IDC) provided with the server software, you can create a very dynamic database query and reporting tool.
An output template file embeds some pretty useful VBScript code into the page displayed in response to the IDC script.
An IDC script is a file used by the IDC to generate a database query. This query based on HTML form input variables, or it always can execute the same SQL statement.