User Guide
130 Chapter 6: Insert Bar Objects
// Just return -- don't do anything else.
return;
}
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;
}
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).
Then, in the Strikethrough.htm file, add the form. After the body tag, 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). The form for this example is a simple checkbox that calls the
fontColorRed()
function when the user clicks on it. The entire Strikethrough.htm file should contain the
following code:
<html>
<head>
<title>Strikethrough</title>
<script language="javascript" src=”Strikethrough.js”>
</script>
</head>
<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>
</body>
</html>