Up to this point, we've continually stressed that a scriptlet is nothing more than an HTML page (don't worry—this fact hasn't changed!). So the basic architecture of a scriptlet must follow the general template of a Web page.
<HTML>
<HEAD>
<TITLE>Title of the Scriptlet Component</TITLE>
</HEAD>
<SCRIPT language=VBScript>
' Any scripts needed
</SCRIPT>
<BODY>
Constituent elements of the scriptlet's user interface
</BODY>
</HTML>
What is outlined above is the skeleton template of any HTML page. Scriptlets are no different. In the <BODY>
section you can put anything that can be placed inside a Web page, even nothing at all! The body of a scriptlet will display through the client site at run-time. (Of course, when talking about a Web browser and Web pages, the expression "at run-time" always means "when the page is viewed through the browser".)
So, basically, a scriptlet is a page embedded inside another page. The container works as it includes an ActiveX control able to display HTML pages. This viewer actually shows the scriptlet page. The script code defined in the container page can refer to the scriptlet by name and can control it via the exposed public interface.
From the scriptlet side, each exposed property or method corresponds to an internal subroutine that executes when the property or the method gets called. The internal procedures are usually written in JavaScript or VBScript and work just like ordinary scripts in an ordinary HTML page. That is, by modifying the state and the style of the constituent objects, firing and receiving events and performing specific tasks.
Now, let's see all this in more detail, starting with the internal layout of a scriptlet.