Whether the FCKeditor content is empty must be determined when submitting the form. We will share the following two forms with you. If you are interested, refer
Form 1:
The Code is as follows:
Function checkFCK (key)
{
Var oEditor = FCKeditorAPI. GetInstance (key );
Var content = oEditor. GetXHTML (true );
Content = content. replace (// g ,"");
Content = content. replace (/\ s/g ,"");
Content = content. replace (// g ,"");
Content = content. replace (/ /G ,"");
Content = content. replace (/
<\/P>/g ,"");
Content = content. replace (/
<\/P>/g ,"");
If (content = null | content = ""){
OEditor. SetHTML ("");
Return false;
}
Return true;
}
Form 2:
The Code is as follows:
Function GetMessageLength (str)
{
Var oEditor = FCKeditorAPI. GetInstance (str );
Var oDOM = oEditor. EditorDocument;
Var iLength;
If (document. all) // If Internet Explorer.
{
ILength = oDOM. body. innerText. length;
}
Else // If Gecko.
{
Var r = oDOM. createRange ();
R. selectNodeContents (oDOM. body );
ILength = r. toString (). length;
}
Return iLength
}