canAcceptCommand()

Description

This function determines whether the command is appropriate for the current selection.

NOTE

Do not define canAcceptCommand() unless it returns a value of false in at least one case. If the function is not defined, the command is assumed to be appropriate. Making this assumption saves time and improves performance.

Arguments

None.

Returns

Adobe Dreamweaver expects a true value if the command is allowed; if the value is false, Adobe Dreamweaver dims the command in the menu.

Example

The following example of the canAcceptCommand() function makes the command available only when the selection is a table:

function canAcceptCommand(){ var retval=false; var selObj=dw.getDocumentDOM.getSelectedNode(); return (selObj.nodeType == Node.ELEMENT_NODE && ¬ selObj.tagName=="TABLE");{ retval=true;}return retval;}