That isn't quite right. It doesn't work, and even worse, when I click on any tab bar button, it writes the text of the function into the body of the html of the edited document.
This is the entire code on the page that contains the CuteEdit control. Is this where the code should be added? When I pasted it in exaclty , it didn't work.
function CheckRequired()
{
result = true;
var nRequired = document.SaveForm.required.value;
if (nRequired == 1)
{
var txt = document.SaveForm.txtContent.value;
if (txt.length <= 0 || txt.length == 13 && txt.toString().toLowerCase() == "")
{
alert(toUnicode("<%= res.GetString("STR_8")%>"));
result = false;
}
}
return result
}
function newRelatedArticle(kbid)
{
strFeatures = "width=600; height=450; toolbar=no; menubar=no; location=no; directories=no";
strTitle = window.open("/kb/article/selectArticleFrame1.aspx?kb=" + kbid + "&v=SaveForm.iaid", "selectArticlePopUp", strFeatures);
return false;
}
var _CE = null
function GetCuteEditor()
{
if (_CE == null) _CE = CuteEditor_GetEditor(document.getElementById('<% = CuteEdit.ClientID %>'));
return _CE;
}
function warning()
{
var result = false;
if (confirm(toUnicode("<%= res.GetString("STR_2")%>")))
{
document.SaveForm.editortype.value = 0;
document.SaveForm.changeEditor.value = 1;
result = true;
}
else
{
result = false;
}
return result;
}
function textControl()
{
string = "showTemplate();";
setTimeout(string,1000);
}
function showTemplate()
{
document.getElementById("loading").style.display = "none";
editor.style.display = "block";
SetWidth(30)
}
var SetWidthTimer = null;
function SetWidth(tries)
{
tries--;
var ce = GetCuteEditor();
if (ce == null || typeof(ce.SetWidth) == "undefined" && tries > 0)
{
SetWidthTimer = self.setTimeout("SetWidth(" + tries + ")", 300);
return;
}
if (SetWidthTimer != null) self.clearTimeout(SetWidthTimer);
if (tries < 1) return;
var w = document.getElementById("divEditor").offsetWidth;
ce.SetWidth(w > 600 ? w-2 : 600);
var h = document.documentElement.clientHeight-150;
ce.SetHeight(h > 400 ? h : 400);
}
function Update(action, rr)
{
if(action=1)
{
window.navigate("articleProperties.aspx?aid=" + aid + "&r=" + rr);
}
}
function ConfirmCancel()
{
if(confirm(toUnicode("<%=res.GetString("STR_18")%>")))
{
document.SaveForm.submitValue.value="cancel";
document.SaveForm.submit();
}
return false;
}
function getSelectedHTML(button)
{
var CuteEdit= GetCuteEditor();
var editwin = CuteEdit.GetWindow();
var rng=null, html="";
if(document.selection && document.selection.createRange)
{
rng=editdoc.selection.createRange();
html=rng.htmlText||"";
}else if(window.getSelection)
{
rng=editwin.getSelection();
if(rng.rangeCount> 0 && window.XMLSerializer)
{
rng=rng.getRangeAt(0);
html=new XMLSerializer().serializeToString(rng.cloneContents());
}
}
return html;
}
var DialogWindow = null;
function ShowArticleLinkDialog(button)
{
var editor=CuteEditor_GetEditor(button);
var text = getSelectedHTML(button);
DialogWindow = editor.ShowDialog(null,"InsertArticleLink.aspx?text=" + text
,editor,"dialogWidth:420px;dialogHeight:230px");
}
var LinkHTML = "";
function ShowThreadLinkDialog(button)
{
var editor=CuteEditor_GetEditor(button);
LinkHTML = getSelectedHTML(button);
DialogWindow = window.open
(
"InsertThreadLink.aspx",
"InsertThreadLink",
"width=440,height=180,dialogWidth=440px,dialogHeight=180px,toolbar=no,menubar=no,location=no,directories=no"
);
}
Geoff SwensonSeattle Washington