spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column22


Passing Data to Behaviors

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

A Behavior describes the dynamic appearance of HTML elements that are associated with the specified Behavior. As such, Behavior does not include data of its own. It needs to operate on data that is stored in the Web page. This data is passed to the Behavior through the named properties specified in the interface section of the scriptlet. The Automation type of <IMPLEMENTS> tag includes these properties:


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

Notice the / at the end of each PROPERTY tag. It replaces the </PROPERTY> tag that one would expect to find at the end of the PROPERTY tag.

The property names specified in the scriptlet interface must match those in the DHTML elements. You can pick any names you want and as many properties as you want. In our example, we associate a Behavior with a DIV element. The x and y interface properties above are specified in the DIV definition as follows:


<DIV CLASS="soccer" x="200" y="250">

Inside the script section of the scriptlet, you can use interface properties like any other local variables. In our Blinking Soccer example, we use the x and y properties to position a dynamic HTML element (DIV):


style.pixelTop = x;
style.pixelLeft = y;

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Created: July 19, 1998
Revised: July 19, 1998

URL: http://www.webreference.com/js/column22/data.html