beautypg.com

Apply the change property behavior, Apply the check browser behavior – Adobe Dreamweaver CS3 User Manual

Page 358

background image

DREAMWEAVER CS3

User Guide

351

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. If not, select another event or change the target browser in

the Show Events For submenu.

Apply the Change Property behavior

Use the Change Property behavior to change the value of one of an object’s properties (for example, the background
color of a div or the action of a form).

Note: Use this behavior only if you are very familiar with HTML and JavaScript.

1

Select an object and choose Change Property from the Actions menu of the Behaviors panel.

2

From the Type Of Element menu, select an element type to display all the identified elements of that type.

3

Select an element from the Element ID menu.

4

Select a property from the Property menu, or enter the name of the property in the box.

5

Enter the new value for the new property in the New Value field.

6

Click OK and verify that the default event is correct. If not, select another event or change the target browser in

the Show Events For submenu.

Apply the Check Browser behavior

Note: This behavior is deprecated as of Dreamweaver 9. To access it, you must select the ~Deprecated menu item from
the Actions menu of the Behaviors panel.

Use the Check Browser behavior to send visitors to different pages depending on their browser brands and versions.
For example, you may want to send visitors using Netscape Navigator 4.0 to a different page than visitors using
Internet Explorer 4.0.

It’s useful to attach this behavior to the

tag of a page that is compatible with practically any browser (and that

does not use any other JavaScript); this way, visitors who come to the page with JavaScript turned off will still see
something.

Another option is to attach this behavior to a null link (such as

) and have the action

determine the link’s destination based on the visitor’s browser brand and version.

1

Select an object and choose ~Deprecated > Check Browser from the Actions menu of the Behaviors panel.

2

Determine how you want to separate your visitors: by browser brand, by browser version, or both.

3

Specify a version of Netscape Navigator.

4

In the adjacent pop-up menus, select destination options (Go To URL, Go To Alt URL, or Stay On This Page.)

Here, you specify what to do if the browser is the Netscape Navigator version you specified or later and what to do
otherwise.

5

Specify a version of Internet Explorer and select destination options as you did in step 4.

6

Select an option from the Other Browsers menu to specify what to do if the browser is neither Netscape Navigator

nor Internet Explorer.

Stay On This Page is the best option for browsers other than Netscape Navigator and Internet Explorer because most
do not support JavaScript—and if they cannot read this behavior, they will stay on the page anyway.

September 4, 2007