Adobe Extending Dreamweaver CS4 Manual do Utilizador Página 232

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 387
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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.
Vista de página 231
1 2 ... 227 228 229 230 231 232 233 234 235 236 237 ... 386 387

Comentários a estes Manuais

Sem comentários