This section provides tutorial example on how to embed a VBScript code in a HTML document to be executed by Internet Explorer on the client machine.
Internet Explorer (IE) is a Microsoft application that can be used a Web browser to view Web pages.
IE also supports a VBScript host environment that allows you to embed VBScript codes into source codes of
Web pages - HTML documents.
VBScript codes embeded in HTML documents will be executed
while IE is rendering HTML documents on the browser window.
This is also called client side scripting, becauses script codes are executed on the client machine
instead of the server machine.
To add VBScript codes into your HTML documents, you need to use the "script" tag with
the "language=vbscript" attribute. Inside the "script" tag, you can place any number of VB statements.
Here is the syntax of adding VBScript codes in HTML documents:
3. View the HTML document with IE. You should see the following message in the IE window:
Hello world! - VBScript in IE
Congratulations. You have successfully written a VBScript code for the host environment
supported in IE!
What happened here was:
We have added a "script" tag in our HTML document, hello_vb.html.
We included a simple VBScript code inside the "script" tag.
The VBScript code calls the "document.write" function,
which is a function provided by the IE host environment
to insert a text string into the HTML document.
We ran IE to view hello_vb.html and got exactly what we expected.