MACROMEDIA DREAMWEAVER 8-DREAMWEAVER API Specifiche Pagina 123

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 692
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 122
Property Inspectors 123
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 appearsso the
canInspectSelection() function returns true every time.
To have a different inspector appear, depending on the value of the
INTJ tags 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 not tags but values of the
META tags 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;
}
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
Vedere la pagina 122
1 2 ... 118 119 120 121 122 123 124 125 126 127 128 ... 691 692

Commenti su questo manuale

Nessun commento