Element Behaviors

Element behaviors where first introduced in Internet Explorer 5.5 and these are basically the replacement for scriptlets. The main difference between ordinary behaviors and element behaviors is that the behavior cannot not be added nor removed at runtime. This means that the element will always have the desired behavior. Element behaviors also support a feature called view link and that basically means that the element containts its own document much like a scriptlet. To read more about behaviors and element behaviors see MSDN .


To use the element behavior you need to first set up the page to include the behavior and then finally create your element. To do this you first need to define the xml namespace prefix to use for the clock element. In this case we use the prefix webfx and this is what the html start tag should look like.

<html xmlns:webfx="http://webfx.eae.net">

After this we need to bind the tag name to the behavior implementation. This is done using the IMPORT processing instruction (PI).

<?IMPORT namespace="webfx" implementation="clock.htc"?>

Then all you have to do is to create the element.


Element properties

The behavior defines a few properties that allows you to change all the colors as well as set the current time zone of the clock.

Name Description
secondsPointerColor The color of the seconds pointer.
minutesPointerColor The color of the minutes pointer.
hoursPointerColor The color of the hours pointer.
plateColor The color of the background plate.
plateStrokeColor The color of the round border of the plate.
timezoneOffset The offset in minutes relative to GMT (UTC).

Notice that the clock uses the clock running on the users computer so if this is not correctly set the time zones will not be corectly reflected either.

VML Clock
Element Behavior
Element Behavior Demo

Author: Erik Arvidsson