zoukankan      html  css  js  c++  java
  • FCKeditorAPI 手册

    1. function abc()    
    2.   {    
    3.    var checkContent =FCKeditorAPI.GetInstance("editor");//获取实例    
    4.    alert(checkContent.GetXHTML());//获取当前内容    
    5.    var newelement = document.createElement("a");    
    6.    newelement.href="#";    
    7.    newelement.innerHTML="df";    
    8.    checkContent.InsertElement(newelement);//前部添加元素(无返回值)    
    9.    var a=checkContent.InsertElementAndGetIt(newelement);//前部添加元素(返回元素)    
    10.    checkContent.InsertHtml("")//添加html    
    11.    checkContent.SetHTML("",true);//设置内容,后为bool,是否所见即所得    
    12.      
    13.   }    
    14.   function aaa()    
    15.   {    
    16.   var checkContent =FCKeditorAPI.GetInstance("editor");//获取实例    
    17.   checkContent.SwitchEditMode();//转变编辑模式    
    18.   checkContent.UpdateLinkedField();//更新关联文件    
    19.   }    
    20. function FCKeditor_OnComplete( checkContent )//当加载完    
    21.   {    
    22.    alert( checkContent.Name ) ;    
    23.   }    
    24.   
    25. //设置fckeditor为只读    
    26. function FCKeditor_OnComplete(editorInstance)    
    27.     {    
    28.         editorInstance.EditorDocument.body.disabled = true;    
    29.         editorInstance.EditorWindow.parent.document.getElementById          ('xExpanded').style.display = 'none';    
    30.         editorInstance.EditorWindow.parent.document.getElementById('xCollapsed').style.display = 'none';    
    31.         editorInstance.EditorWindow.blur();    
    32. }    
    33.   
    34. //向编辑器插入指定代码    
    35. function insertHTMLToEditor(codeStr){    
    36.   var oEditor = FCKeditorAPI.GetInstance("content");    
    37.   if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG){    
    38.     oEditor.InsertHtml(codeStr);    
    39.   }else{    
    40.     return false;    
    41.   }    
    42. }    
    43. //统计编辑器中内容的字数    
    44. function getLength(){    
    45.   var oEditor = FCKeditorAPI.GetInstance("content");    
    46.   var oDOM = oEditor.EditorDocument;    
    47.   var iLength ;    
    48.   if(document.all){    
    49.     iLength = oDOM.body.innerText.length;    
    50.   }else{    
    51.     var r = oDOM.createRange();    
    52.     r.selectNodeContents(oDOM.body);    
    53.     iLength = r.toString().length;    
    54.   }    
    55.   alert(iLength);    
    56. }    
    57. //执行指定动作    
    58. function ExecuteCommand(commandName){    
    59.   var oEditor = FCKeditorAPI.GetInstance("content") ;    
    60.   oEditor.Commands.GetCommand(commandName).Execute() ;    
    61. }    
    62. //设置编辑器中内容    
    63. function SetContents(codeStr){    
    64.   var oEditor = FCKeditorAPI.GetInstance("content") ;    
    65.   oEditor.SetHTML(codeStr) ;    
    66. }    
    67.   
    68. //使用FCKEditor时使用js在光标处添加任意字符串    
    69. function InsertHTML(e,inStr)//e:FCKEditor的ID,inStr:要插入的信息    
    70. {    
    71.         var oEditor = FCKeditorAPI.GetInstance(e) ;    
    72.        if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )    
    73.           {    
    74.            oEditor.InsertHtml( inStr ) ;    
    75.         }    
    76.          else    
    77.             alert("You must be on WYSIWYG mode!" ) ;    
    78.     }    
    79.   
    80.     function ExecuteCommand( commandName,e )    
    81.      {    
    82.          var oEditor = FCKeditorAPI.GetInstance(e) ;    
    83.          oEditor.Commands.GetCommand(commandName ).Execute() ;    
    84.     }   
  • 相关阅读:
    [转载] 淘宝千万级并发分布式架构的14次演进
    [转载] 分布式锁用Redis还是Zookeeper?
    .Net面试题收集
    List,set,Map 的用法和区别
    android 布局中 layout_gravity、gravity、orientation、layout_weight
    Android getWindow().setFlags方法
    android动画之Interpolator和AnimationSet
    Android中Animation详解
    android ImageView scaleType属性
    tools:context=".MainActivity的作用
  • 原文地址:https://www.cnblogs.com/buaaboyi/p/1944404.html
Copyright © 2011-2022 走看看