June 23, 2000 - HTML Components
June 23, 2000|
Tips: June 2000
Yehuda Shiran, Ph.D.
One of the drawbacks of ActiveX Controls is that they require installation on the client machine before usage. HTML Controls, on the other hand, are downloaded to the client machine with the primary document that the user downloads any way. HTML Controls are also more attractive to DHTML authors because they can develop their own controls and components in a language they are already familiar with, DHTML.
HTCs provide a simple mechanism to implement DHTML behaviors in script. An HTC file is nothing but an HTML file, saved with an
.htc extension, that contain scripts and a set of HTC-specific custom elements that expose properties, methods, and events that define the component. All HTC elements are accessible from script as objects using their ID attributes. This allows all attributes and methods of HTC elements to be dynamically manipulated through script.
Next, we show the
CALENDAR custom tag:
<PUBLIC:COMPONENT tagName="CALENDAR"> <ATTACH EVENT="oncontentready" ONEVENT="fnInit()"/> </PUBLIC:COMPONENT>
PUBLIC:COMPONENT tag is used to declare the new
CALENDAR tag. In between the opening and closing tags you can attach events to the new
CALENDAR tag. The event is
oncontentready which is fired when the imported
calendar.htc file is fully loaded and rendered on the containing page.