Operation Manual

338
USING DREAMWEAVER
Adding JavaScript behaviors
Last updated 3/28/2012
Apply the Set Text Of Status Bar behavior
The Set Text Of Status Bar behavior shows a message in the status bar at the lower-left corner of the browser window.
For example, you can use this behavior to describe the destination of a link in the status bar instead of showing the
URL associated with it. Visitors often ignore or overlook messages in the status bar (and not all browsers provide full
support for setting the text of the status bar); if your message is important, consider displaying it as a pop-up message
or as the text of an AP element.
Note: If you use the Set Text Of Status Bar behavior in Dreamweaver, the text of the status bar in the browser is not
guaranteed to change because some browsers require special adjustments when changing status bar text. Firefox, for
example, requires that you change an Advanced option that lets JavaScript change status bar text. For more information,
see your browser’s documentation.
You can embed any valid JavaScript function call, property, global variable, or other expression in the text. To embed
a JavaScript expression, place it inside braces (
{}). To display a brace, precede it with a backslash (\{).
Example:
The URL for this page is {window.location}, and today is {new Date()}.
1 Select an object and choose Set Text > Set Text Of Status Bar from the Add Behavior menu of the Behaviors panel.
2 In the Set Text Of Status Bar dialog box, type your message in the Message box.
Keep the message concise. The browser truncates the message if it doesn’t fit in the status bar.
3 Click OK and verify that the default event is correct.
Apply the Set Text Of Text Field behavior
The Set Text Of Text Field behavior replaces the content of a form’s text field with the content you specify.
You can embed any valid JavaScript function call, property, global variable, or other expression in the text. To embed
a JavaScript expression, place it inside braces (
{}). To display a brace, precede it with a backslash (\{).
Example:
The URL for this page is {window.location}, and today is {new Date()}.
Create a named text field
1 Select Insert > Form > Text Field.
If Dreamweaver prompts you to add a form tag, click Yes.
2 In the Property inspector, type a name for the text field. Make sure the name is unique on the page (don’t use the
same name for multiple elements on the same page, even if they’re in different forms).
Apply Set Text Of Text Field
1 Select a text field and choose Set Text > Set Text Of Field from the Add Behavior menu of the Behaviors panel.
2 Select the target text field from the Text Field menu and enter your new text.
3 Click OK and verify that the default event is correct.