Справочник Пользователя для Macromedia dreamweaver 8-extending dreamweaver

Скачать
Страница из 504
284
Property Inspectors
// Get the value of the DIRECTION attribute on the MARQUEE tag. 
var theDirection = theObj.getAttribute('direction');
// Initialize a variable for the DIRECTION attribute to -1. 
// This is used to store the menu index that corresponds to
// the value of the attribute.
// var typeIndex = -1;
var directionIndex = -1;
  
// If there was a DIRECTION attribute...
if (theDirection){
// If the value of DIRECTION is "left", set typeIndex to 0.
if (theDirection.toLowerCase() == "left"){
directionIndex = 0;
// If the value of DIRECTION is "right", set typeIndex to 1.
}else if (theDirection.toLowerCase() == "right"){
directionIndex = 1;
 }
}
// If the value of the DIRECTION attribute was "left"
// or "right", choose the corresponding
// option from the pop-up menu in the interface.
if (directionIndex != -1){
document.topLayer.document.topLayerForm.marqDirection.selectedIndex 
=¬ directionIndex;
}
}
4.
To get the current selection and make the text box in the Property inspector display the 
direction
 attribute’s value, add the following function at the end of the file:
function setMarqueeTag(){
// 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 directionIndex = ¬
document.topLayer.document.topLayerForm.marqDirection.selectedIndex;
// Get the value of the selected option in the pop-up menu
// in the interface.
var theDirection = ¬
document.topLayer.document.topLayerForm.marqDirection.¬
options[directionIndex].value;
// Set the value of the direction attribute to theDirection.
theObj.setAttribute('direction',theDirection);
}
5.
Save the file as marquee.js in the Configuration/Inspectors folder.