Unit 13. Using Behaviours (I)

In this theme we're going to learn the basic characteristics of behaviours, and also look at a pair of examples of possible applications.



Behaviours are actions that happen when the user makes any move over an object, for example moving the mouse over an image, clicking on a text, double-clicking on an image map, etc.

Behaviours don't exist as HTML code, they are programmed by JavaScript. Dreamweaver allows you to insert them through the Behaviors panel, so it is not necessary to write a JavaScript code line to program them.

The image below has a behaviour associated. Place the mouse to see what happen.



The image has two behaviors associated to show and hide the layer. We'll look at this kind of behaviour later.

Other behaviors you have seen are the ones applied to sustitution bars and browser bars, they are predefined, and for this reason it isn't necessary to introduce the set of behaviors through Behavior panel.

To validate forms you saw some of the caracteristics of Behavior panel. Let's remember which we need to insert behaviors later.

The Behavior panel can be opened through the Window menu, and then the Behaviors option, also by pressing Shift+F3.

In this panel you need to clic on the button, and in Show events for selecting a version from the browser list.

Some behaviours don't work with some browsers, depending on the selected browser you will see or not see some possible behaviours.

There are many behaviours for Internet Explorer but they don't work with Netscape.This is because most users use Internet Explorer, lets select this browser. You can select from one of its latest versions: IE 5.5 o IE 6.0.

Once the browser is selected its not necessary to re-select it the following time you want to insert any behaviour.


Inserting a behaviour


When there is an established browser, you can insert behaviors.

The first thing to do is to select the object on which the behaviuor is going to be applied, it can be an image, a text fragment, etc.

When you clic on the button of Behavior panel you will see the Show Events for option, through it is the same you had selected the browser. Also, you see a list of all possible actions in the browser previously selected, or you can select one.

Depending on the element on which you want to apply the behaviuor, you can select some actions, and others not.


In this case the Validate form action cannot be selected because there isn't any form in the Page.

After choosing any action, the corresponding behaviour appears in Behaviors panel. In this case, two behaviors have been inserted.

As you can see, each behaviour has an action and an event associated to it.

Actions are the ones which have been selected in the previous list, and the event indicates the time of the action.

To clear any behaviour, you need to select it in Behaviors panel and clic on the button. You can also change the order of the behaviours applied to an object, by selecting them and arranging their order through the buttons.

  Go to the previous page page Content  Go to the nex page  

Page 13.1

Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited.