USING BEHAVIORS

Behaviors are pre-written JavaScript code that perform a variety of tasks from Image Rollover to creating navigation bars, validation, etc.  While they still can be used for some tasks, they are not as popular as they use to be in light of other emerging technologies like Flash, Flex, Spry/AJAX, LightBox, etc.

How to Insert a Behavior

  1. Typically you have to select a tag (i.e., <a> tag) that has a link associated with it. It does not have to be a real link. You can use a dummy link (i.e., #) in the Link field in other for the Behavior to be desplayed in the Behavior drop down list.
  2. Select Window > Behaviors (SHIFT+F4) to open the Behavior panel.
  3. Click on the Add Behavior icon (the one with the plus sign) in the Behaviors dialog box and then select a behavior from the list the you woulike to applied.
  4. Fill in the necessary fields and then click OK.

How to Edit Update Behavior

  1. Select the object that has the behavior applied to it.
  2. Make any required changes to the default values in the Behavior panel (i.e., change onClick to onDoubleClick).

Example: Implementing the Swap Image Behavior

  1. Create two set of images that are the same size but have differrnt look (b&w and color versions).
  2. Select the image and then select Windows > Behaviors from the menu.
  3. Click on the Add Behavior icon and then select the Swap Image behavior from the list.
  4. In the Swap Image Behavior dialog box, click on the Browse button and select the image you want to swap.
  5. Click OK and test in browser.