spacer
Yehuda Shiran December 22, 1999
Scriptlet Authoring
Tips: December 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

A scriptlet is an independent script that is referenced from an HTML page. It represents an object that accepts data from the outside and supports several operations on this data. A scriptlet describes the behavior of an object and the event it is triggered by. A scriptlet also allows you to define new events. Scriptlets are supported by Internet Explorer 4.0 and up and are not supported by Netscape Navigator. Internet Explorer 5.0 added the support for Behaviors to scriptlets. A scriptlet resides in a file of its own, with extension .sct. A scriptlet file opens with a <SCRIPTLET> tag and closes with a </SCRIPTLET> tag:

<SCRIPTLET>......</SCRIPTLET>

A scriptlet is divided into two parts: the interface definition section and the internal implementation section. The interface definition section includes IMPLEMENTS tags. Each IMPLEMENTS tag opens with <IMPLEMENTS> and closes with </IMPLEMENTS>. There are two types of <IMPLEMENTS> tags: <Behavior> and <Automation>. The <Behavior> type specifies the event associated with the Behavior, such as the following:

<IMPLEMENTS ID="kuku" TYPE="Behavior" DEFAULT>
<EVENT NAME="onFifthBlink"/>
</IMPLEMENTS>

The Automation type of the <IMPLEMENTS> tag specifies the scriptlet's object interface parameters and supported methods:

<IMPLEMENTS TYPE="Automation">
<METHOD NAME="blink"/>
<PROPERTY NAME="x"/>
<PROPERTY NAME="y"/>
</IMPLEMENTS>

The internal implementation section consists of a JavaScript script. This script implements the internal details of the object's methods. As seen above, only one method is defined, the blink() function. The whole internal implementation can be found in Column 22, Scriptlet Authoring.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business