MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Specifikace Strana 296

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 504
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 295
296 Floating Panels
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.
To add the updateScript() function:
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.
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 or
the
dw.toggleFloater('scriptEditor') 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
menuitem tag that
creates an entry for the Script Editor extension on the Window menu, as shown in the
following figure:
Zobrazit stránku 295
1 2 ... 291 292 293 294 295 296 297 298 299 300 301 ... 503 504

Komentáře k této Příručce

Žádné komentáře