User Guide

A simple Insert Object example 127
After Dreamweaver applies the formatting, it should return the cursor to the document without
any messages or prompting. The following example shows how the
objectTag() function
now reads:
function objectTag() {
// Determine if the user is in Code view.
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('<S>','</S>');
}else{
dom.source.wrapSelection('<s>','</s>');
}
// If the user is not in Code view, apply the formatting in the Design view
}else if (dw.getFocus() == 'document'){
dom.applyCharacterMarkup("s");
}
// Just return -- don't do anything else.
return;
}
The following example shows how the entire Strikethrough.htm file reads the proper closing
HTML tags:
<html>
<head>
<title>Strikethrough</title>
<script language="javascript">
//--------------- API FUNCTIONS ---------------
function isDOMRequired() {
// Return false, indicating that this object is available in code view.
return false;
}
function objectTag() {
// Determine if the user is in Code view.
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('<S>','</S>');
}else{
dom.source.wrapSelection('<s>','</s>');
}
// If the user is not in Code view, apply the formatting in the Design view
}else if (dw.getFocus() == 'document'){
dom.applyCharacterMarkup("s");
}
// Just return -- don't do anything else.
return;
}