Define a behavior for an element

Behaviors in Microsoft Expression Web are scripting options that enable you to quickly add interactivity or increased functionality to text or other elements of your web page. When you add a behavior to an element, Expression Web writes JavaScript code in your page to manage the behavior. Some common behaviors include setting the status bar text, displaying a message box, or changing the formatting of an element when the mouse pointer hovers over the element or checking for the browser a user is viewing your page in and redirecting to a different page for some browsers, or swapping images when the mouse pointer passes over an image. For more information about behaviors, see Behavior scripts.

To add a Behavior to an element

  1. On the Format menu, click Behaviors to open the Behaviors task pane.

  2. In Design view, select the page element — for example, text or a graphic — you want to work with.

  3. In the Behaviors task pane, click Insert, and then click the action you want.

  4. In the dialog box that appears, select the options you want, and then click OK.

  5. To select the event, under Events, click the default event, and then click the event you want.

  6. Depending on the action you choose, select any additional options that define the event for the action

Community Additions