Adobe Extending Dreamweaver CS4 Instrukcja Użytkownika Strona 232

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 387
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 231
226
EXTENDING DREAMWEAVER CS4
Floating panels
2 Enter the following code in the header section of the file.
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['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';
}
}
3 Save the file.
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.
1 Open the scriptEditor.htm file that is in the Configuration/Floaters folder.
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>
3 Save the file.
Przeglądanie stron 231
1 2 ... 227 228 229 230 231 232 233 234 235 236 237 ... 386 387

Komentarze do niniejszej Instrukcji

Brak uwag