The returned dimensions are smaller than the size of the entire dialog box because they do not
include the area for the OK and Cancel buttons. If the returned dimensions do not accommodate
all options, scroll bars appear.
Example
The following instance of
to 648 x 520 pixels:
function windowDimensions(){
return "648,520";
}
What to do when an action requires a return value
Sometimes an event handler must have a return value (for example,
onMouseOver="window.status='This is a link'; return true"
inserts the
"return behaviorName(args)"
list are skipped.
To get around this limitation, set the
value within the string that the
Dreamweaver to insert
the event handler. For an example about using the
Form.js file in the Configuration/Behaviors/Actions folder within the Dreamweaver
application folder.
A simple behavior example
To understand how behaviors work and how you can create one, it's helpful to look at an example.
The Configuration/Behaviors/Actions folder inside the Dreamweaver application folder contains
examples, but many are too complex except for the most advanced developers. Start with the
simple Action file Call JavaScript.htm (along with its counterpart, Call JavaScript.js, which
contains all the JavaScript functions).
The following code presents a relatively simple example. It checks the brand of the browser and
goes to one page if the brand is Netscape Navigator and another if the brand is Microsoft Internet
Explorer. This code can easily be expanded to check for other brands such as Opera and WebTV
and modified to perform actions other than going to URLs.
<!DOCTYPE HTML SYSTEM "-//Macromedia//DWExtension layout-engine 5.0//dialog">
<html>
<head>
<title>behavior "Check Browser Brand"</title>
<meta http-equiv="Content-Type" content="text/html">
<script language="JavaScript">
// The function that will be inserted into the
// HEAD of the user's document
function checkBrowserBrand(netscapeURL,explorerURL) {
if (navigator.appName == "Netscape") {
if (netscapeURL) location.href = netscapeURL;
}else if (navigator.appName == "Microsoft Internet Explorer") {
if (explorerURL) location.href = explorerURL;
}
}
windowDimensions()
document.MM_returnValue
behaviorFunction()
return document.MM_returnValue
sets the dimensions of the Parameters dialog box
action into the event handler, behaviors later in the
function returns. This setting causes
at the end of the list of actions in
MM_returnValue
). But if Dreamweaver
variable to the desired return
variable, see the Validate
The Behaviors API
243
Need help?
Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?