MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Dokumentacja Strona 202

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 504
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 201
202 Menus and Menu Commands
Creating the dynamic menu items
The following menu tags in the menus.xml file define the Preview in Browser submenu of the
File menu:
<menu name="_Preview in Browser" id="DWMenu_File_PIB">
<menuitem dynamic name="No Browsers Selected"
file="Menus/MM/PIB_Dynamic.htm" arguments="'No Browsers'"
id="DWMenu_File_PIB_Default" />
<separator />
<menuitem name="_Edit Browser List..." enabled="true"
command="dw.editBrowserList()" id="DWMenu_File_PIB_EditBrowserList" />
</menu>
The first menuitem tag defines the default menu item No Browsers Selected, which appears
on the submenu if you have not specified any browsers for the Preview in Browser item in
Preferences. If you specified the Microsoft Internet Explorer browser, however, the submenu
would look like the following figure:
The
name attribute for the first menu item specifies the command file PIB_Dynamic.htm.
This file contains the following line:
<SCRIPT LANGUAGE="javascript" SRC="PIB_Dynamic.js"></SCRIPT>
The script tag includes the JavaScript code in the PIB_Dynamic.js file, which supplies the
JavaScript code that interacts with the Preview in Browser submenu. This code could be saved
directly in the PIB_Dynamic.htm file, but storing it in a separate file allows multiple
commands to include the same code.
Writing the JavaScript code
Because the first menuitem tag contains the dynamic attribute, Dreamweaver calls the
getDynamicContent() function in the PIB_Dynamic.js file, which is shown in the following
example:
function getDynamicContent(itemID)
{
var browsers = null;
var PIB = null;
var i;
var j=0;
browsers = new Array();
PIB = dw.getBrowserList();
Przeglądanie stron 201
1 2 ... 197 198 199 200 201 202 203 204 205 206 207 ... 503 504

Komentarze do niniejszej Instrukcji

Brak uwag