Attaching a behavior to text
You can't attach a behavior to plain text. Tags like
there's 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 doesn't 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 don't want it to look like a link, but site visitors may then
be unaware that there's a reason to click that text.
To attach a behavior to the selected text:
In the Property inspector, enter
1
colon and the semicolon.
Note: You can instead use a number sign (#) in the Link text box if you want. The problem with
using a number sign is that when a visitor clicks the link, some browsers may jump to the top of the
page. Clicking the JavaScript null link has no effect at all on the page, so the JavaScript approach
is generally preferable.
With the text still selected, open the Behaviors panel (Window > Behaviors).
2
Select an action from the Actions pop-up menu, enter parameters for the action, and select an
3
event to trigger the action. For detailed information, see
To change the appearance of linked text to make it look like it isn't a link:
Open the Document window's Code view by selecting View > Code.
1
Find the link.
2
In the link's
3
a href
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
Formatting Text," on page
374
Chapter 18: Using JavaScript Behaviors
javascript:;
tag, insert this attribute: style="text-decoration:none; color:black".
273.
and
don't generate events in browsers, so
p
span
in the Link text box. Be sure to include both the
"Applying a behavior" on page
Chapter 13, "Inserting and
373.
Need help?
Do you have a question about the DREAMWEAVER MX 2004-USING DREAMWEAVER and is the answer not in the manual?
Questions and answers