MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Especificaciones Pagina 155

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 504
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 154
A simple insert object example 155
To create the function:
1. After the objectTag() function in Strikethrough.js, create a function called
fontColorRed() by entering the following code:
function fontColorRed(){
var dom = dw.getDocumentDOM();
if (dw.getFocus() == 'textView' || dw.getFocus(true) == 'html'){
var upCaseTag = (dw.getPreferenceString("Source Format", "Tags
Upper Case", "") == 'TRUE');
// Manually wrap tags around selection.
if (upCaseTag){
dom.source.wrapSelection('<FONT COLOR="#FF0000">','</FONT>');
}else{
dom.source.wrapSelection('<font color="#FF0000">','</font>');
}
}else if (dw.getFocus() == 'document'){
dom.applyFontMarkup("color", "#FF0000");
}
// Just return -- don't do anything else.
return;
}
2.
Save the file as Strikethrough.js.
Next, in the Strikethrough.htm file, you add the form. The form for this example is a simple
checkbox that calls the
fontColorRed() function when the user clicks on it. You use the
form tag to define your form, and the table tag for layout control (otherwise, the dialog box
might wrap words or size awkwardly).
To add the form:
1. After the body tag, add the following code:
<form>
<table border="0" height="100" width="100">
<tr valign="baseline">
<td align="left" nowrap>
<input type="checkbox" name="red" onClick=fontColorRed()>Red text</
input>
</td>
</tr>
</table>
</form>
NOTE
Because dom.applyCharacterMarkup() doesn’t support font color changes, you need
to find the appropriate API function for font color changes. (For more information,
see
dom.applyFontMarkup() in the Dreamweaver API Reference).
Vista de pagina 154
1 2 ... 150 151 152 153 154 155 156 157 158 159 160 ... 503 504

Comentarios a estos manuales

Sin comentarios