
A simple menu command example 199
function canAcceptCommand()
{
var selarray;
if (arguments.length != 1) return false;
var bResult = false;
var whatToDo = arguments[0];
if (whatToDo == "undo")
{
bResult = dw.canUndo();
}
else if (whatToDo == "redo")
{
bResult = dw.canRedo();
}
return bResult;
}
receiveArguments()
Dreamweaver calls the receiveArguments() function to process any arguments that you
defined for the
menuitem tag. For the Undo and Redo menu items, the receiveArguments()
function calls either the
dw.undo() function or the dw.redo() function, depending on
whether the value of the argument,
arguments[0], is "undo" or "redo". The dw.undo()
function undoes the previous step that the user performed in the document window, dialog
box, or panel that has focus. The
dw.redo() function redoes the last operation that was
undone.
The
receiveArguments() function looks like the following example code:
function receiveArguments()
{
if (arguments.length != 1) return;
var whatToDo = arguments[0];
if (whatToDo == "undo")
{
dw.undo();
}
else if (whatToDo == "redo")
{
dw.redo();
}
}
Kommentare zu diesen Handbüchern