Specifications
Objects 57
The Objects API
This section describes the functions in the Objects API. You must define either the
insertObject() function or the objectTag() function. The remaining functions are optional.
canInsertObject()
Availability
Dreamweaver MX
Description
Determines whether to display the Object dialog box.
Arguments
None.
Returns
Dreamweaver expects a Boolean value.
Example
function canInsertObject(){
var docStr = dw.getDocumentDOM().documentElement.outerHTML;
var patt = /hava/;
var found = ( docStr.search(patt) != -1 );
var insertionIsValid = true;
if (!found){
insertionIsValid = false;
alert("the document must contain a ’hava’ string to use this object.\nHa
Ha."); }
return insertionIsValid;}
displayHelp()
Description
If this function is defined, displays a Help button below the OK and Cancel buttons in the
Parameters dialog box. This function is called when the user clicks the Help button.
Arguments
None.
Returns
Dreamweaver expects nothing.
Example
// the following instance of displayHelp() opens
// in a browser a file that explains how to use
// the extension.
function displayHelp(){
var myHelpFile = dw.getConfigurationPath() +
’/ExtensionsHelp/superDuperHelp.htm’;
dw.browseDocument(myHelpFile);
}