This tutorial is mainly about how to use JS to set the editor to get focus to get the FCK editor content to determine whether it is empty, and the content length and JS call the FCK editor method.
var checkcontent =fckeditorapi.getinstance ("content"). getxhtml ();
Write a function
function Geteditorhtmlcontents (editorname) {
var oeditor = fckeditorapi.getinstance (editorname);
Return (Oeditor.getxhtml (true));
}
Editor gets focus
var oeditor = fckeditorapi.getinstance (' content ');
Oeditor.focus ();
Write a function
Set editor Focus
function seteditorcontents (editorname, contentstr) {
var oeditor = fckeditorapi.getinstance (editorname);
Oeditor.focus;
}
The above method is simple to write
Length Verification:
Fckeditorapi.getinstance ("Content"). getxhtml (). length;
Also let the editor have the focus:
var oeditor = fckeditorapi.getinstance (' content '); Oeditor.focus ();
FCKeditor js Calling method
<script src= "Fckeditor/fckeditor.js" ></script>
<script type= "text/web Effects" >
<!--
function Showfck () {
var ofckeditor = new FCKeditor (' content ');
Ofckeditor.basepath = ' fckeditor/';
Ofckeditor.toolbarset = ' basic ';
Ofckeditor.width = ' 100% ';
Ofckeditor.height = ' 200 ';
Ofckeditor.value = ';
Ofckeditor.replacetextarea ();
document.getElementById ("Btnshow"). Disabled = ' true ';
document.getElementById ("Btnshow"). Style.display = ' None ';
}
-->
</script>
<textarea name= "Content" ></textarea>
<input id=btnshow style= "display:inline" Type=button onclick= "SHOWFCK ()" >
FCK Recommended Download Address
Http://down.111cn.net/webedit/2009/0429/fck-dedecms.html