canAcceptCommand(): enable the toolbar item
The canAcceptCommand() function consists of one line of code that checks to see whether there is a current Document Object Model (DOM) and whether the document is parsed as HTML. The function returns the results of those tests. If the conditions are true, Adobe Dreamweaver enables the text box item on the toolbar. If the function returns the value false, Adobe Dreamweaver disables the item.
The function is as follows:
function canAcceptCommand(){ return (dw.getDocumentDOM() != null && dw.getDocumentDOM().getParseMode() == 'html');}