User Guide

Script Editor: a floating panel extension 233
If the selected node is not an element, or it is not a SCRIPT tag, the selectionChanged()
function makes the layer
blanklayer visible and hides scriptlayer. The blanklayer floating
panel displays the text (no script selected), as shown in the following figure:
updateScript(): write back changes
The
updateScript() function writes back the selected script when an onBlur event occurs in
the
textarea of the scriptlayer panel. The textarea form element contains the JavaScript
code and the
onBlur event occurs when textarea loses input focus. The updateScript()
function looks like the following example:
/* update the document with any changes made by
the user in the textarea */
function updateScript(){
var theDOM = dw.getDocumentDOM();
var theNode = dw.getSelectedNode();
theNode.innerHTML = document.layers['scriptlayer'].document.¬
theForm.scriptCode.value;
}
</script>
</head>
Saving the file in the Floaters folder
The next step is to save the JavaScript and HTML code in the scripteditor.htm file in the
Configuration/Floaters folder. Saving the scriptEditor.htm file in the Floaters folder makes the
floating panel extension available to Dreamweaver.