Accessibility

TechNote (Archived)

Applying JavaScript behaviors to text links

Issue



How can JavaScript behaviors be assigned to text?

Reason



Behaviors cannot be assigned to text. They can be assigned to text links. Making a link out of text surrounds the text with <a> tags, to which you can attach a behavior.

Solution


Surround the text with <a> tags (this will make the text a link).

Assigning a behavior to text

1 Select the text to which you will assign the behavior.
2 Choose Window > Properties to open the Property inspector.
3

Make the text either a link or a null link:

Link: Click the folder icon to the right of the Link text box to browse to and select a file.

Null link ( a hypertext link that remains on the same page when clicked on): Type the following in the Property inspector's Link text box:

javascript:;

4 Reselect the linked text.
5 Choose Window > Behaviors to open the Behaviors panel.
6 Click the Plus (+) button.
7 From the Behavior panel's Actions pop-up menu, select a behavior.
8 Enter the appropriate parameters for your behavior in the dialog box that appears (if any) and click OK.
9 Choose File > Save.
10 Choose File > Preview in Browser to test the behavior in a browser.
Note:To easily remove the blue link underline appearing with the text that has been converted into a null link, see How to remove underlines from linked text (Technote 14088).

Additional Information
For more information about null links, seeNull links cause browser to jump to top of page(Technote 14105).



AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_15495

Products Affected: