Attaching a behavior to text
You cant attach a behavior to plain text. Tags like
span dont generate events in browsers, so theres no way to trigger an action from those tags.
However, you can attach a behavior to a link. Therefore, to attach a behavior to text, the easiest approach is to add a null link (that doesnt point to anything) to the text, then attach the behavior to the link. Note that if you do this, your text will appear as a link. You can change the link color and remove the underlining if you really dont want it to look like a link, but site visitors may then be unaware that theres a reason to click that text.
To attach a behavior to the selected text:
- In the Property inspector, enter
You can instead use a number sign (
- With the text still selected, open the Behaviors panel (Window > Behaviors).
- Select an action from the Actions pop-up menu, enter parameters for the action, and select an event to trigger the action. For detailed information, see Applying a behavior.
To change the appearance of linked text to make it look like it isnt a link:
- Open the Document windows Code view by selecting View > Code.
- Find the link.
- In the links
href tag, insert this attribute: style="text-decoration:none; color:black".
This attribute setting disables underlining and sets the color of the text to black. (Of course, if the surrounding text is a different color, use that color instead of black.)
Note that this attribute is an inline CSS style. An inline style applied to a single link overrides other CSS styles that apply to that link, but has no effect outside of that link. To change the appearance of linked text everywhere on a page or across your entire site, use CSS styles to create a new style for links. For detailed information, see Inserting and Formatting Text.