Attaching a behavior

You can attach behaviors to the entire document (the BODY) or to links, images, form elements, or any of several other HTML elements. Which elements can accept behaviors depends upon the browser. 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 listed. For information on changing the order of actions, see Changing a behavior.

To attach a behavior:

1 Select an object.
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 Choose Window > Behaviors to open the Behavior inspector, or click the Behavior button on the Launcher.
The HTML tag of the selected object appears in the title bar.
3 Click the plus button and choose an action from the Actions pop-up menu.
Actions that don't work in the current document are not available on the menu. For example, the Play Timeline action is not available if the document has no timelines.
Depending on the chosen action, a dialog box appears to display parameters and instructions for the action.
4 Enter parameters for the action and click OK.
All included actions work in 4.0 or later browsers. Some actions do not work in older browsers. See Using the behavior actions that ship with Dreamweaver.
5 The default event for the action appears in the Events column. If this is not the event that you want, select another event from the Events pop-up menu.
Different events appear depending on the selected object and the browsers specified in the Events For pop-up menu. If the expected events don't appear, make sure that the correct object is selected, or change the target browsers in the Events For pop-up menu.
If you're attaching a behavior to an image, events such as onMouseOver and onMouseDown appear in parentheses. These events are available only for links. When you choose one of them, Dreamweaver wraps an A tag around the image to define a link. Do not delete the pound sign (#) that subsequently appears in the Link box in the Property inspector, or you will remove the behavior. You can replace the pound sign with a new link value if you like.