Applying a behavior

Applying a behavior

You can attach behaviors to the entire document (that is, to the body tag) or to links, images, form elements, or any of several other HTML elements.

The target browser you select determines which events are supported for a given element. Internet Explorer 4.0, for example, has a much wider array of events for each element than Netscape Navigator 4.0 or any 3.0 browser.

You can specify more than one action for each event. Actions occur in the order in which they’re listed in the Actions column of the Behaviors panel. For information on changing the order of actions, see Changing a behavior.

To attach a behavior:

  1. Select an element on the page, such as an image or a link.

    To attach a behavior to the entire page, click the <body> tag in the tag selector at the bottom left of the Document window.

  2. Select Window > Behaviors to open the Behaviors panel.
  3. Click the Plus (+) button and select an action from the Actions pop-up menu.

    Actions that are dimmed in the menu can’t be chosen. They may be dimmed because a required object doesn’t exist in the current document. For example, the Control Shockwave or Flash action is dimmed if the document contains no Shockwave or Macromedia Flash SWF files. If no events are available for the selected object, all actions are dimmed.

    When you select an action, a dialog box appears, displaying parameters and instructions for the action.

  4. Enter parameters for the action, and click OK.

    All actions provided in Dreamweaver work in 4.0 and later browsers. Some actions do not work in older browsers. See Using the behavior actions that come with Dreamweaver.

  5. The default event to trigger the action appears in the Events column. If this is not the trigger event you want, select another event from the Events pop-up menu. (To open the Events pop-up menu, select an event or action in the Behaviors panel, and click the downward-pointing black arrow that appears between the event name and the action name.)

Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Inserting and Formatting Text
Adding Audio, Video, and Interactive Elements
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly