Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Scriptlets can initiate two kinds of events that can be received and acted on by the containing HTML document. These are onscriptletevent events and standard window events such as mouse clicks and keypresses. The onscriptletevent event includes a string and an object parameter; the external HTML document can base its action on the contents of the string and interpret the object parameters appropriately.

Using Scriptlets in HTML Documents

After a Scriptlet is created, including it and using it within an HTML document is a simple procedure. A Scriptlet is included in an HTML document by using the <OBJECT> tag with the following syntax:

<OBJECT ID=“Calendar” WIDTH=400 HEIGHT=270 TYPE=“text/x-scriptlet”>
   <PARAM NAME=“URL” VALUE=“Calendar.htm”>
</OBJECT>

Like other Web browser objects, the ID attribute is used to name the object so that it can be accessed by scripts within the page. The WIDTH and HEIGHT attributes define the size of the object within the page. The Scriptlet <OBJECT> tag’s TYPE attribute uses the MIME type text/x-scriptlet to tell Internet Explorer that this object is a Scriptlet. Finally, the <PARAM> tag is used to give the URL of the Scriptlet itself.

Scriptlet Example

Microsoft maintains a collection of samples of many of its technologies, including Dynamic HTML and Scriptlets, at http://www.microsoft.com/workshop/c.htm#/gallery/samples/default.asp. Figure 26.16 shows one of the demos from this site, the Calculator Scriptlet Demo, in action. Notice the following features of this demonstration:

  The HTML needed to implement the table containing the calculator, as well as the supporting scripts, is all contained within the Calculator Scriptlet.
  Scriptlet methods are attached to each of the buttons shown in the page below the calculator; these buttons are part of the external document, not the Scriptlet itself. Clicking any of them calls a Scriptlet method with the contents of the adjacent text field to set the corresponding property of the Scriptlet.
  Dynamic HTML is used to dynamically change the contents of the calculator display when any of its buttons are pressed.
  Figure 26.16 shows how the document can respond to two kinds of Scriptlet events. The number of the day that the mouse is over changes to the highlight color, responding to an onMouseOver event; and whenever a calculator button is clicked, responding to an onClick event, the display is changed appropriately. Both of these events are internal events in the Scriptlet, and the external HTML document never receives any indication of them.


FIGURE 26.16  Scriptlets give you an easy way to reuse Web applications within other HTML documents.

Find Out More About Dynamic HTML

It would be possible to write an entire book on Dynamic HTML, so there is no way it can be covered in the space that has been allotted here. The object of this chapter was to give you the resources for getting started with your own Web pages by using Microsoft’s implementation of Dynamic HTML and Internet Explorer. To see more about both Microsoft and Netscape Dynamic HTML, check out Que Publishing’s Special Edition, Using Dynamic HTML. If you would like to see more examples and to find out more information, try some of these links on the Microsoft Web site.

  Features of Dynamic HTML in Internet Explorer 4
The Internet Explorer 4 Web site includes introductory information on all the features of its suite of applications and technologies. The information on Dynamic HTML is located at
http://www.microsoft.com/ie/ie40/features/ie-dhtml.htm
  Internet Explorer 4 demos
In addition to information, the Internet Explorer 4 also offers a series of demos, many of which make use of the new features of Dynamic HTML. The demos are at
http://www.microsoft.com/ie/ie40/demos/
  Microsoft SiteBuilder Network
Microsoft’s SiteBuilder Network is the area of its Web site devoted to providing information to Web authors and developers who use Microsoft products. The SiteBuilder Network hosts a Dynamic HTML Gallery at
http://www.microsoft.com/workshop/c.htm#/workshop/author/default.asp
  Microsoft Internet Client SDK documentation
The Internet Client Software Development Kit (SDK) includes the technical information and software needed to author pages and develop applications and components that use Internet Explorer 4. Part of the SDK is extensive information and documentation on Dynamic HTML and the new Document Object Model that supports it. You can download and also view this documentation online at
http://www.microsoft.com/msdn/sdk/inetsdk/help/
  Inside Dynamic HTML Web site
The Inside Dynamic HTML Web site includes a mass of information and samples of Dynamic HTML in action. It is located at
http://www.insidedhtml.com/


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.