Adobe 38040334 - Dreamweaver CS3 User Manual page 158

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

The first
tag defines the default menu item No Browsers Selected, which appears on the submenu if you
menuitem
have not specified any browsers for the Preview In Browser item in the Preferences dialog box. If you specified the
Microsoft Internet Explorer browser, however, the submenu would look like the following figure:
The
attribute for the first menu item specifies the command file PIB_Dynamic.htm. This file contains the
name
following line:
<SCRIPT LANGUAGE="javascript" SRC="PIB_Dynamic.js"></SCRIPT>
The
tag includes the JavaScript code in the PIB_Dynamic.js file, which supplies the JavaScript code that
script
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
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();
for (i=0; i<PIB.length; i=i+2)
{
browsers[j] = new String(PIB[i]);
if (dw.getPrimaryBrowser() == PIB[i+1])
browsers[j] += "\tF12";
else if (dw.getSecondaryBrowser() == PIB[i+1])
browsers[j] += "\tCmd+F12";
browsers[j] += ";id='"+escQuotes(PIB[i])+"'";
if (itemID == "DWPopup_PIB_Default")
browsers[j] = MENU_strPreviewIn + browsers[j];
j = j+1;
}
return browsers;
}
tag contains the
dynamic
attribute, Dreamweaver calls the
DREAMWEAVER CS3
Extending Dreamweaver
getDynamicContent()
152

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents