User Guide

220 Chapter 12: Property Inspectors
Example
The following example of the displayHelp() function opens a file in a browser window. The file
explains the fields of the Property inspector.
function displayHelp(){
dw.browseDocument(‘http://www.hooha.com/dw/inspectors/inspHelp.html’);
}
inspectSelection()
Description
Refreshes the contents of the text fields based on the attributes of the current selection.
Arguments
maxOrMin
The maxOrMin argument is either max or min, depending on whether the Property inspector is
in its expanded or contracted state.
Returns
Dreamweaver expects nothing.
Example
The following example of the inspectSelection() function gets the value of the CONTENT
attribute and uses it to populate a form field called
keywords:
function inspectSelection(){
var dom = dreamweaver.getDocumentDOM();
var theObj = dom.getSelectedNode();
document.forms[0].keywords.value = ¬
theObj.getAttribute("content");
}
A simple Property inspector example
The following Property inspector inspects a fictional tag called
INTJ. The INTJ tag is empty (it
has no closing tag), so its selection type is
exact. As long as the selection is an INTJ tag, the
Property inspector appears—so the
canInspectSelection() function returns a true value every
time. To have a different inspector appear, depending on the value of the
INTJ tag’s TYPE
attribute, for example, the canInspectSelection() function must check the value of the TYPE
attribute to determine which Property inspector is the right one. (This is how the keywords and
description Property inspectors work, because “keywords” and “description” are values, not tags,
of the
META tag’s NAME attribute.)
<!-- tag:INTJ,priority:5,selection:exact,vline,hline -->
<!DOCTYPE HTML SYSTEM "-//Macromedia//DWExtension layout-engine5.0//pi">
<HTML>
<HEAD>
<TITLE>Interjection Inspector</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function canInspectSelection(){
return true;
}