setMenuText()

Adobe Dreamweaver calls the setMenuText() function to determine what text appears for the menu item. If you do not define the setMenuText() function, Adobe Dreamweaver uses the text that you specified in the name attribute of the menuitem tag.

The setMenuText() function checks the value of the argument that Adobe Dreamweaver passes, arguments[0]. If the value of the argument is "undo", Adobe Dreamweaver calls the dw.getUndoText() function; if it is "redo", Adobe Dreamweaver calls dw.getRedoText(). The dw.getUndoText() function returns text that specifies the operation that Adobe Dreamweaver will undo. For example, if the user executes multiple Redo operations, dw.getUndoText() could return the menu text "Undo Edit Source." Likewise, the dw.getRedoText() function returns text that specifies the operation that Adobe Dreamweaver will redo. If the user executes multiple Undo operations, the dw.RedoText() function could return the menu text "Redo Edit Source."

The setMenuText() function looks like the following example code:

function setMenuText(){ if (arguments.length != 1) return ""; var whatToDo = arguments[0]; if (whatToDo == "undo") return dw.getUndoText(); else if (whatToDo == "redo") return dw.getRedoText(); else return "";}