Macromedia dreamweaver 8-using dreamweaver User Manual

Page of 1030
516
Chapter 18:  Using JavaScript Behaviors
4.
Click the Get Current HTML button to copy the current contents of the target frame’s 
body
 section.
5.
Enter a message in the New HTML text box and click OK.
6.
Check that the default event is the one you want. If it isn’t, select another event from the 
pop-up menu. 
If you don’t see the events you want, change the target browser in the Show Events For 
pop-up menu.
Set Text of Layer
The Set Text of Layer action replaces the content and formatting of an existing layer on a page 
with the content you specify. The content can include any valid HTML source code. 
Set Text of Layer replaces the content and formatting of the layer, but retains layer attributes, 
including color. Format the content by including HTML tags in the New HTML text box of 
the Set Text of Layer dialog box.
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()}.
To create a layer:
1.
Select Insert > Layer.
For more information, see 
.
2.
In the Property inspector, type a name for the layer.
To use the Set Text of Layer action:
1.
Select an object and open the Behaviors panel. 
2.
Click the Plus (+) button and select Set Text > Set Text of Layer from the Actions 
pop-up menu.
3.
In the Set Text of Layer dialog box, use the Layer pop-up menu to select the target layer.
4.
Enter a message in the New HTML text box, then click OK.
5.
Check that the default event is the one you want. If it isn’t, select another event from the 
pop-up menu. 
If you don’t see the events you want, change the target browser in the Show Events For 
pop-up menu.