Adobe 38040334 - Dreamweaver CS3 User Manual page 229

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

if (theNode.nodeType == Node.ELEMENT
theNode.tagName == "SCRIPT"){
document.layers['scriptlayer'].visibility = 'visible';
document.layers['scriptlayer'].document.theForm.¬
scriptCode.value = theNode.innerHTML;
document.layers['blanklayer'].visibility = 'hidden';
}else{
document.layers['scriptlayer'].visibility = 'hidden';
document.layers['blanklayer'].visibility = 'visible';
}
}
Save the file.
3
updateScript(): write back changes
The
function writes back the selected script when an
updateScript()
panel. The
scriptlayer
textarea
loses input focus.
textarea
To add the updateScript() function:
Open the scriptEditor.htm file that is in the Configuration/Floaters folder.
1
2
Enter the following code in the header section of the file.
/* update the document with any changes made by
the user in the textarea */
function updateScript(){
var theDOM = dw.getDocumentDOM();
var theNode = theDOM.getSelectedNode();
theNode.innerHTML = document.layers['scriptlayer'].document.¬
theForm.scriptCode.value;
}
</script>
</head>
Save the file.
3
Creating a menu item
It is not sufficient to save the Script Editor code in the Configuration/Floaters folder. You must also call either the
dw.setFloaterVisibility('scriptEditor',true)
function to load the floating panel and make it visible. The most obvious place from which to invoke the Script Editor
is from the Window menu, which is defined in the menus.xml file. You need to create the
an entry for the Script Editor extension on the Window menu, as shown in the following figure:
_
NODE && ¬
form element contains the JavaScript code, and the
function or the
event occurs in the
onBlur
event occurs when
onBlur
dw.toggleFloater('scriptEditor')
menuitem
DREAMWEAVER CS3
223
Extending Dreamweaver
of the
textarea
tag that creates

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents