Scriptlet Architecture

Scriptlets are simply HTML pages that contain client-side script, which conforms to a standard scripting architecture. This architecture, similar to VC++ and VB, defines what routines and variables are public (that is exposed to the control's container on the page) and private (hidden from the control's container).

When a scriptlet is loaded into memory, it is loaded into an instance of the HTML parsing engine that is itself wrapped inside a COM container. This container is placed inside the HTML parsing engine of the original HTML page that contains the reference to the Scriptlet. This implementation means that the Scriptlet can let Internet Explorer handle all of the housekeeping tasks of the component, so that all we have to worry about is creating the HTML page that contains the internal logic of our Scriptlet. Once it is inserted into the original HTML page, it effectively becomes an ActiveX control.

It's important to realize that our Scriptlet control has the option of providing a user interface. Since it is parsed by the HTML parsing engine, we can use standard HTML and Dynamic HTML within our scriptlet to provide information to the user. In the remainder of this first section of the chapter, we'll show you very briefly two simple examples of Scriptlets in use, and see the basics of their implementation.