User Guide
The Property inspector API 221
function inspectSelection(){
// Get the DOM of the current document var
// theDOM = dw.getDocumentDOM();
// Get the selected node var theObj = theDOM.getSelectedNode();
// Get the value of the TYPE attribute on the INTJ tag var
// theType = theObj.getAttribute('type');
// Initialize a variable called typeIndex to -1. This will be
// used to store the menu index that corresponds to
// the value of the TYPE attribute
var typeIndex = -1;
// If there was a TYPE attribute
if (theType){
// If the value of TYPE is "jeepers", set typeIndex to 0
if (theType.toLowerCase() == "jeepers"){
typeIndex = 0;
// If the value of TYPE is "jinkies", set typeIndex to 1
}else if (theType.toLowerCase() == "jinkies"){
typeIndex = 1;
// If the value of TYPE is "zoinks", set typeIndex to 2
}else if (theType.toLowerCase() == "zoinks"){
typeIndex = 2;
}
}
// If the value of the TYPE attribute was "jeepers",
// "jinkies", or "zoinks", choose the corresponding
// option from the pop-up menu in the interface
if (typeIndex != -1){
document.topLayer.document.topLayerForm.intType.¬
selectedIndex = typeIndex;
}
}
function setInterjectionTag(){
// Get the DOM of the current document
var theDOM = dw.getDocumentDOM();
// Get the selected node
var theObj = theDOM.getSelectedNode();
// Get the index of the selected option in the pop-up menu
// in the interface
var typeIndex = document.topLayer.document.¬
topLayerForm.intType.selectedIndex;
// Get the value of the selected option in the pop-up menu
// in the interface
var theType = document.topLayer.document.¬
topLayerForm.intType.options[typeIndex].value;
// Set the value of the TYPE attribute to theType
theObj.setAttribute('type',theType);
}
</SCRIPT>
</HEAD>
<BODY>
<SPAN ID="image" STYLE="position:absolute; width:23px; ¬
height:17px; z-index:16; left: 3px; top: 2px">
<IMG SRC="interjection.gif" WIDTH="36" HEIGHT="36" ¬