Internet Explorer 5.0, Part II: Behavior Handler's Location - Doc JavaScript | 2 | WebReference

Internet Explorer 5.0, Part II: Behavior Handler's Location - Doc JavaScript | 2


Behavior Handler's Location

You can specify the URL location of the Behavior scriptlet using either HTML or JavaScript. The HTML syntax is:

{behavior:url(myBehavior)}

and the JavaScript syntax is:

object.style.behavior[ = url(myBehavior) ]

where myBehavior can take the following forms:

There are several ways to specify the Behavior attribute of the element's style. In our Connect Three game, we first define tripleBox, a generic style label that applies to all element types:

<STYLE>
  .tripleBox{behavior:url(xmdbehavior.sct)} 
</STYLE>

and then we include the CLASS="tripleBox" specification in each of the nine IMG statements:

<IMG CLASS="tripleBox" x="50" y="50" onBoxClick="handleBoxClick()" 
onBoxLoad="handleBoxLoad(1,1)">

One alternative is to omit the <STYLE> section altogether, and specify the behavior URL directly in each of the nine IMG statements:

<IMG STYLE="behavior:url(xmdbehavior.sct)" x="50" y="50" 
onBoxClick="handleBoxClick()" onBoxLoad="handleBoxLoad(1,1)">

Yet another alternative is to specify the behavior URL in the scriptlet itself, similarly to the other style properties set there. The first few JavaScript lines in the scriptlet would have been read like this:

style.position = "absolute";
style.pixelTop = y;
style.pixelLeft = x;
style.behavior = "url(xmdbehavior.sct)";

https://www.internet.com


Created: August 11, 1998
Revised: August 11, 1998

URL: https://www.webreference.com/js/column23/location.html