Contents Index Topic Contents |
Scriptlets Overview
A scriptlet is a Web page based on Dynamic HTML (DHTML) that you can use as a control in any application that supports controls. The scriptlet is a complete Web-ready .htm file, but includes information that allows you to work with it as a control — you can get and set its properties, call its methods, and so on.
Scriptlets:
- Allow Web page authors to create reusable user interface components without having to harness the full power of C, C++, or other control-building environments.
- Allow developers using Visual Basic, Visual InterDev, and other development environments that support controls to make use of features built into Web pages.
- Are easy to create and maintain.
- Are small and efficient.
For example, with scriptlets you can:
- Use the graphical and hypertext capabilities of Web pages as visually rich interface for your application.
- Change the appearance and behavior of Web pages from within the host environment. For example, you can use a Visual Basic application to read information from files and then write it into the scriptlet.
- Prototype controls that you intend to write in other environments. Because it is quick and easy to put together a scriptlet, you can test ideas. When you have completed your design, you can reimplement the control in another environment, such as C++, Visual Basic, or J++, if you want greater performance or a different means of packaging your control.
How Scriptlets Works
You use scriptlets like a standard control. In the scriptlet, you create any properties, methods, or events that you want by simply creating scripts in common active scripting languages such as JavaScript, Visual Basic Scripting Edition (VBScript), or another language. The scripts rely on the scripting capabilities of DHTML, which gives you a complete object model for elements on the scriptlet.
For example, a scriptlet might be a Web page that contains animation based on DHTML that moves and resizes text on the page. You can write scripts to expose properties that allow another application to set the text, speed, and direction of the animation text, and methods that allow another application to start, stop, and pause the animation.
Note To learn more about using Dynamic HTML in your Web pages, you can view the documentation for the Internet Client SDK located here.
Support for scriptlets is built into Internet Explorer 4.0. You can use the standard OBJECT tag to insert and work with scriptlets as you do any other object on a Web page.
To use the scriptlet in applications that support ActiveX controls, you use a control called the scriptlet container object, which hosts the scriptlet. The host application, such as Visual Basic, uses the scriptlet container object to create a window for the scriptlet and provide a way for the host application to specify what scriptlet to use, where it displays, at what size, and so on. The scriptlet container object also provides the interface for you to set and get the scriptlet's properties, call its methods, and respond to its events.
Scriptlet Security
In a security-aware host application such as Internet Explorer, the scriptlet and any controls contained within it are subject to Internet Explorer 4.0 security. For information about security settings in Internet Explorer 4.0, see Internet Explorer Help.
Typically, the security settings for the zone containing the scriptlet's server must be Medium or Low. If the setting is High, the scriptlet will not download to your computer. If you usually set custom security settings for a zone, set both Script ActiveX controls marked safe for scripting and Initialize and script ActiveX controls not marked as safe to either Prompt or Enable.
The same applies to any controls that the scriptlet contains, including other scriptlets, especially if the scriptlet contains controls that reside on a server in a different zone.
When you distribute an application that uses a scriptlet, make sure that users set the security settings in their copy of Internet Explorer to the correct level to allow them to use your scriptlets.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.