To create the function:
1.
After the
objectTag()
fontColorRed()
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;
}
Because
dom.applyCharacterMarkup()
to find the appropriate API function for font color changes. (For more information,
see
dom.applyFontMarkup()
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
tag to define your form, and the table tag for layout control (otherwise, the dialog box
form
might wrap words or size awkwardly).
To add the form:
1.
After the
tag, add the following code:
body
<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>
function in Strikethrough.js, create a function called
by entering the following code:
in the Dreamweaver API Reference).
function when the user clicks on it. You use the
fontColorRed()
doesn't support font color changes, you need
A simple insert object example
155
Need help?
Do you have a question about the DREAMWEAVER 8-EXTENDING DREAMWEAVER and is the answer not in the manual?