Working with DHTML Scriptlets

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

A DHTML scriptlet is a Web page that exposes a user interface that can be used from another Web page. To create a DHTML scriptlet, you simply create a Web page that displays the user interface you want to save as a scriptlet. You then add any script necessary to make the user interface fully functional. That is all there is to it. For example, the following sample shows the HTML code and script required to create and display a digital clock on a page:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub InitDigiTimer
   ' Specify that the MoveTime procedure should be
   ' called at 1-second intervals.
   window.setInterval "MoveTime", 1000
End Sub

Function MoveTime()   
   document.all("displayTime").innerText = time()
End Function

Sub window_onload()
   InitDigiTimer
End Sub
-->
</SCRIPT>
</HEAD>

<BODY>
<DIV ID=displayTime 
     STYLE="position:absolute; 
            width: 120; 
            height: 20; 
            border:solid; 
            border-color:lightblue;
            border-left-width:thin;
            border-right-width:thin;
            background-color:darkblue;
            color:yellow;
            text-align:center;
            font-family:arial;
            font-weight:bold">
</DIV>
</BODY>
</HTML>

The following figure shows how this HTML code is rendered in the browser.

Digital Clock Scriptlet

Aa189140.01203(en-us,office.10).gif

When you use this file as a scriptlet, only the clock and its related formatting appear in the container Web page. For example, you could name this file DateTime.htmt and use it as a scriptlet from another Web page by inserting the following <OBJECT> tag in the container page:

<OBJECT ID="scrltCode2" 
        STYLE="position:absolute;
               width:150;
               height:40;"
        TYPE="text/x-scriptlet" 
        DATA="DateTime.htm">
</OBJECT>

The only mandatory <OBJECT> tag attributes to create a DHTML scriptlet are TYPE and DATA. The TYPE attribute setting will always be "text/x-scriptlet". The DATA attribute should always contain the path and name of the file you are referencing as a scriptlet. If you want to change the design of the clock, you only have to change the settings for the STYLE attribute in the DateTime.htm file. You can position the clock anywhere on the container page by enclosing the <OBJECT> tags shown above in <DIV> tags with STYLE attribute settings indicating precisely where on the page you want the clock to appear.

See Also

Working with Office Web Discussions Client | Enabling Discussions | Understanding the Global Object | Understanding Discussion Servers | Understanding Discussions | Understanding Subscriptions