beautypg.com

Adobe Extending Dreamweaver CS4 User Manual

Page 231

background image

225

EXTENDING DREAMWEAVER CS4

Floating panels

selectionChanged(): is a script marker selected?
The

selectionChanged()

function determines whether a script marker has been selected in Design view. A script

marker appears in Design view if there is a JavaScript routine in the body section of a document and if Scripts is selected
on the Invisible Elements section of the Preferences dialog box. The following figure shows a script marker icon:

The

selectionChanged()

function first calls the

dw.getDocumentDOM()

function to get the Document Object

Model (DOM) for the user’s document. It then calls the

getSelectedNode()

function to see if the selected node for

that document is, first, an element and, second, a

SCRIPT

tag. If both these conditions are true, the

selectionChanged()

function makes the

scripteditor

floating panel visible and loads it with the underlying

JavaScript code. It also sets the

visibility

property of the

blanklayer

floating panel to the value

hidden

. The

following figure shows the

scriptlayer

floating panel with the selected JavaScript code:

If the selected node is not an element, or it is not a

script

tag, the

selectionChanged()

function makes the

blanklayer

floating panel visible and hides the

scriptlayer

panel. The

blanklayer

floating panel displays the text

(no script selected)

, as shown in the following figure:

Add the selectionChanged() function

1

Open the file scriptEditor.htm that is in the Configuration/Floaters folder.

This manual is related to the following products: