Take a look at this HTML file. It has a <style> element that
defines a behavior for the <h1> element:
<html>
<head>
<style>
h1 { behavior: url(behave.htc) }
</style>
</head>
<body>
<h1>Move your Mouse over me</h1>
</body>
</html>
The behavior code is stored in an XML document behave.htc as
shown below:
<component>
<attach for="element" event="onmouseover" handler="hig_lite" />
<attach for="element" event="onmouseout" handler="low_lite" />
<script language="JavaScript">
function hig_lite()
{
element.style.color=255
}
function low_lite()
{
element.style.color=0
}
</script>
</component>
The behavior file contains JavaScript. The script is wrapped in
a <component> element. The component wrapper also contains the
event handlers for the script. Nice behavior, isn't it?