beautypg.com

Update a behavior, Download and install third-party behaviors, Applying built-in javascript behaviors – Adobe Dreamweaver CC 2015 User Manual

Page 422: Using built-in behaviors, Apply the call javascript behavior

background image

415

Javascript

Last updated 6/3/2015

Update a behavior

1

Select an element that has the behavior attached to it.

2

Choose Window > Behaviors and double-click the behavior.

3

Make your changes and click OK in the behavior’s dialog box.

All occurrences of that behavior in that page are updated. If other pages on your site have that behavior, you must
update them page by page.

Download and install third-party behaviors

Many extensions are available on the Exchange for Dreamweaver website
(

www.adobe.com/go/dreamweaver_exchange

).

1

Choose Window > Behaviors and select Get More Behaviors from the Add Behavior menu.

Your primary browser opens, and the Exchange site appears.

2

Browse or search for packages.

3

Download and install the extension package you want.

For more information, see

Add and manage extensions in Dreamweaver

.

Applying built-in JavaScript behaviors

Note: The user interface has been simplified in Dreamweaver CC and later. As a result, you may not find some of the
options described in this article in Dreamweaver CC and later. For more information, see

this article

.

Using built-in behaviors

The behaviors included with Dreamweaver have been written to work in modern browsers. The behaviors fail silently
in older browsers.

Note: The Dreamweaver actions have been carefully written to work in as many browsers as possible. If you remove code
from a Dreamweaver action by hand, or replace it with your own code, you may lose cross-browser compatibility.

Although the Dreamweaver actions were written to maximize cross-browser compatibility, some browsers do not
support JavaScript at all, and many people who browse the web keep JavaScript turned off in their browsers. For best
cross-platform results, provide alternative interfaces enclosed in

Apply the Call JavaScript behavior

The Call JavaScript behavior executes a custom function or line of JavaScript code when an event occurs. (You can write
the script yourself, or you can use code provided by various freely available JavaScript libraries on the web.)

1

Select an object and choose Call JavaScript from the Add Behavior menu of the Behaviors panel.

2

Type the exact JavaScript to be executed, or type the name of a function.

For example, to create a Back button, you might type if (history.length > 0){history.back()}. If you have encapsulated
your code in a function, type only the function name (for example, hGoBack()).

3

Click OK and verify that the default event is correct.