Example
The following example of
depending on whether the selection is a script marker. If the selection is a script marker,
Dreamweaver makes the script layer visible. Otherwise, Dreamweaver makes the blank
layer visible.
function selectionChanged(){
/* get the selected node */
var theDOM = dw.getDocumentDOM();
var theNode = theDOM.getSelectedNode();
/* check to see if the node is a script marker */
if (theNode.nodeType == Node.ELEMENT_NODE && ¬
theNode.tagName == "SCRIPT"){
document.layers['blanklayer'].visibility = 'hidden';
document.layers['scriptlayer'].visibility = 'visible';}
else{
document.layers['scriptlayer'].visibility = 'hidden';
document.layers['blanklayer'].visibility = 'visible';
}
}
About performance
Declaring the
selectionChanged()
panels can impact Dreamweaver performance adversely. Consider that the
and
documentEdited()
mouse click when Dreamweaver is idle for more than one-tenth of a second. It's important to
use different scenarios to test your floating panel, using large documents (100K or more of
HTML) whenever possible, to test performance impact.
To help avoid performance penalties, the
global method in Dreamweaver 3. As in the browsers, the
arguments: the JavaScript to be called and the amount of time in milliseconds to wait before
calling it.
The
method lets you build pauses into your processing. These pauses let the
setTimeout()
user continue interacting with the application. You must build in these pauses explicitly
because the screen freezes while scripts process, which prevents the user from performing
further edits. The pauses also prevent you from updating the interface or the floating panel.
The following example is from a floating panel that displays information about every layer in
the document. It uses the
each layer.
selectionChanged()
or
documentEdited()
selectionChanged()
setTimeout()
method to pause for a half second after processing
setTimeout()
shows a different layer in the floating panel,
function in your custom floating
functions are called after every keystroke and
function was implemented as a
setTimeout()
The Floating panel API
function takes two
303
Need help?
Do you have a question about the DREAMWEAVER 8-EXTENDING DREAMWEAVER and is the answer not in the manual?
Questions and answers