A single event can trigger several different actions, and you can specify the order in which those actions occur.
You use the Behaviors panel (Window > Behaviors) to attach behaviors to page elements (more specifically to tags) and to modify parameters of previously attached behaviors.
Behaviors that have already been attached to the currently selected page element appear in the behavior list (the main area of the panel), listed alphabetically by event. If several actions are listed for the same event, they will be executed in the order in which they appear on the list. If no behaviors appear in the behavior list, no behaviors have been attached to the currently selected element.
The Behaviors panel has the following options:
Show Set Events
Displays only those events that have been attached to the current document. Events are organized into client-side and server-side categories. Each category’s events are in a collapsible list. Show Set Events is the default view.
Add Behavior (+)
Displays a menu of actions that can be attached to the currently selected element. When you select an action from this list, a dialog box appears in which you can specify parameters for the action. If all the actions are dimmed, no events can be generated by the selected element.
Up and down arrow buttons
Move the selected action up or down in the behavior list for a particular event. You can change the order of actions only for a particular event—for example, you can change the order in which several actions occur for the onLoad event, but all the onLoad actions stay together in the behavior list. The arrow buttons are disabled for actions that can’t be moved up or down in the list.
Displays a pop‑up menu, visible only when an event is selected, of all the events that can trigger the action (this menu appears when you click the arrow button next to the selected event name). Different events appear depending on the object selected. If the events you expect don’t appear, make sure that the correct page element or tag is selected. (To select a specific tag, use the tag selector at the lower-left corner of the Document window.)
For names and descriptions of the events provided by each browser, see the Dreamweaver Support Center at www.adobe.com/go/dreamweaver_support.
Different events appear in the Events menu depending on the selected object. To find out what events a given browser supports for a given page element, insert the page element in your document and attach a behavior to it, then look at the Events menu in the Behaviors panel. (By default, events are drawn from the HTML 4.01 events list, and are supported by most modern browsers.) Events may be disabled (dimmed) if the relevant objects do not yet exist on the page or if the selected object cannot receive events. If the expected events don’t appear, make sure the correct object is selected.
To see which tags you can use with a given event in a given browser, search for the event in one of the files in the Dreamweaver/Configuration/Behaviors/Events folder.
You can attach behaviors to the entire document (that is, to the <body> tag) or to links, images, form elements, and several other HTML elements.
The target browser you select determines which events are supported for a given element.
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, but you can change that order.
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 SWF action is dimmed if the document contains no Shockwave or SWF files.
When you select an action, a dialog box appears, displaying parameters and instructions for the action.
All actions provided in Dreamweaver work in modern browsers. Some actions do not work in older browsers, but they will not cause errors.
Targeted elements require a unique ID. For example, if you want to apply the Swap Image behavior to an image, the image requires an ID. If you don’t have an ID specified for the element, Dreamweaver automatically specifies one for you.
- 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 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.)
After attaching a behavior, you can change the event that triggers the action, add or remove actions, and change parameters for actions.
To edit an action’s parameters, double-click its name, or select it and press Enter (Windows) or Return (Macintosh); then change parameters in the dialog box and click OK.
To change the order of actions for a given event, select an action and click the Up or Down arrow. Alternatively, you can select the action and cut and paste it into the desired location among the other actions.
To delete a behavior, select it and click the Minus (–) button or press Delete.
Many extensions are available on the Exchange for Dreamweaver website (www.adobe.com/go/dreamweaver_exchange).
For more information, see Add and manage extensions in Dreamweaver.