MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Dokumentacja Strona 441

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 504
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 440
Creating Property inspectors for locked content 441
document.layers['timelayer'].document.timeForm.timefield.¬
value = timeValue;
}
After you parse the orig attribute to populate the boxes in the Property inspector for the
translated tag, the next step is probably to set the value of the
orig attribute if the user
changes the value in any of the text boxes. You might find restrictions against making changes
in a locked region. You can avoid this problem by changing the original markup and
retranslating.
The Property inspector for translated server-side includes (the ssi_translated.js file in the
Configuration/Inspectors folder) demonstrates this technique in its
setComment() function.
Rather than rewriting the
orig attribute, the Property inspector assembles a new server-side
include comment. It inserts that comment into the document, replacing the old one by
rewriting the contents of the document, which generates a new
orig attribute. The following
code summarizes this technique:
// Assemble the new include comment. radioStr and URL are
// variables defined earlier in the code.
newInc = "<!--#include " + radioStr + "=" + '"' + URL + '"' ¬
+" -->";
// Get the contents of the document.
var entireDocObj = dreamweaver.getDocumentDOM();
var docSrc = entireDocObj.documentElement.outerHTML;
// Store everything up to the SSI comment and everything after
// the SSI comment in the beforeSelStr and afterSelStr variables.
var beforeSelStr = docSrc.substring(0, curSelection[0] );
var afterSelStr = docSrc.substring(curSelection[1]);
// Assemble the new contents of the document.
docSrc = beforeSelStr + newInc + afterSelStr;
// Set the outerHTML of the HTML tag (represented by
// the documentElement object) to the new contents,
// and then set the selection back to the locked region
// surrounding the SSI comment.
entireDocObj.documentElement.outerHTML = docSrc;
entireDocObj.setSelection(curSelection[0], curSelection[0]+1);
Przeglądanie stron 440
1 2 ... 436 437 438 439 440 441 442 443 444 445 446 ... 503 504

Komentarze do niniejszej Instrukcji

Brak uwag