Assigning Text Behaviors Posted: Saturday, July 26, 2008
In Dreamweaver CS3 it is fairly simple to assign Behaviors
to images (example: open new window, close window, etc.). However, to assign
Behaviors to text you have to do a couple of tricks to get it to work. The
first is the Close Window and the second is the Open Browser Window.
1. Assigning Text the "Close Window" Behavior
Highlight the text you want to assign a Behavior to and in the Properties
palette put in the Link area.
With the same text still selected; go to the Behaviors palette and click
on the + to show the drop down menu.
Choose Call JavaScript from the + menu. In the Call JavaScript window enter
and
click OK.
Now back on the Behaviors palette you will see it has the value of onClick
assigned to the Behavior of Call JavaScript (Close Window).
If you wanted, you could now change the onClick to another type
by clicking on the "onClick" and making a choice from the menu. But we will
be using onClick.
Note if you need to adjust or change the link assigned to the
text; just highlight the text again and then the assigned behavior will appear
in the Behaviors palette and you can double click on the Call Javascript to
re-open the dialogue window.
2. Variation: Assigning Text the "Open
Browser Window" Behavior This makes a pop up window occur from clicking on text.
Highlight the text you want to assign a Behavior to and in the Properties
palette put
in
the Link area.
With the same text still selected; go to the Behaviors palette and
click on the + to show the drop down menu and this time select Open
Browser Window.
In the Open Browser Window choose your URL to display by
clicking on the Browse... button. Fill in the Window width and height.
I usually only check the Scrollbars as needed and Resize handles because
all the other options take up more room in the window area and just aren't
needed. Assign the pop up windows name in the Window name box. Click OK and
your done.