Chapter 2 - Getting Started with Scriptlets

The DHTML model gives you the opportunity to manipulate the elements that actually form an HTML page without restrictions. Therefore, you can see virtually any element of the HTML source code as an object, with its own set of properties, methods and events. DHTML defines a number of objects, and anything you can identify in an HTML document is expressed in terms of one of them.

All the objects are implemented inside the

msHtml.dll
library (a standard part of IE4), and made available to the programmers through COM interfaces. There are specific components for wrapping images, links, applets, and controls, but also for the body of a document, its style, the frames collection, any forms, and so on.

Scriptlets are a step beyond DHTML and provide a way to add new, completely custom built, objects to the DHTML standard objects. These objects aren't binary pieces of code like ActiveX controls, but represent an evolution of DHTML pages and are made out of script and HTML tags. As a result, they are used like the ordinary automation components that you should already be familiar with. Scriptlets are nothing more than HTML documents, with an additional layer of script code that makes them appear to be very similar to controls. On the other hand, since they are HTML pages they might also be seen as custom extensions to the standard DHTML object model.

In this chapter, we're going to present scriptlets. Our first aim will be defining the key aspects of the scriptlets architecture and exploring the differences and similarities between it and ActiveX controls.

Later on, we'll analyze scriptlets in order to evaluate their role and their power with respect to the construction of reusable HTML-based components.

The final goal of the chapter will be discussing some scriptlets portability and security issues. After that, we'll be ready to start talking about scriptlets programming.

In particular, the chapter is intended to cover:

By the end of this chapter, you should have a clear, if theoretical, understanding of the whole subject, and be ready for further discussion and more advanced programming topics.

© 1997 by Wrox Press. All rights reserved.