乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      【精華】FCKeditorAPI 手冊

       CevenCheng 2013-06-25

      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();//更新關聯(lián)文件    
      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. //統(tǒng)計編輯器中內容的字數(shù)    
      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. //執(zhí)行指定動作    
      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.     } 


      Commands 的定義:
      \fckeditor\editor\js\fckeditorcode_ie.js

      自定義 Commands 實戰(zhàn): 自定義我們的打開圖片選擇對話框的命令?。?!

      step1 : 注冊我們自己定義的 Commands    "JSCallbackCommand"
      查找 “|InsertHorizontalRule” 然后再后面插入 "|JSCallbackCommand"   

      step2:定義我們的 JSCallbackCommand  【直接 copy 現(xiàn)有的 FCKDialogCommand 再做修改即可】
      var FCKJSCallbackCommand=function(A,B,C,D,E,F,G,H){
      this.Name=A;
      this.Title=B;
      this.Url=C;
      this.Width=D;
      this.Height=E;
      this.CustomValue=H;
      this.GetStateFunction=F;
      this.GetStateParam=G;
      this.Resizable=false;
      };FCKJSCallbackCommand.prototype.Execute=function(fileUrl){
      try
      {
      FCKDialog.OpenDialog('FCKDialog_'+this.Name,this.Title,this.Url + '?preview=' + encodeURIComponent(fileUrl),this.Width,this.Height,this.CustomValue,null,this.Resizable);
      } catch(e){
      alert(e);
      }
      };FCKJSCallbackCommand.prototype.GetState=function(){if (this.GetStateFunction) 
      return this.GetStateFunction(this.GetStateParam);
      else return FCK.EditMode==0?0:-1;};

      step3 : 注冊進事件處理   
      查找 ";break;default:if (FCKRegexLib.NamedCommands.test(A)) B=new FCKNamedCommand(A);" 然后在 break; 前面插入:

      case 'JSCallback':B=new FCKJSCallbackCommand('JSCallback',FCKLang.DlgImgTitle,'dialog/fck_image.html',450,390);


      這樣,我們自定義的 JSCallbackCommand 就注冊完了?。。?/span>

      到時候可以通過  FCKEditorAPI 直接執(zhí)行該命令, 并且還可以傳遞參數(shù)。

      調用示例:
      var inst = FCKeditorAPI.GetInstance('HTMLeditor1');"
      inst.Commands.GetCommand('JSCallback').Execute('http://a3.att.hudong.com/68/93/01300000556189125362932760553_140.jpg');"

      結果就是,瀏覽器打開一個彈出圖片dialog, 并且默認選中了這張圖片


        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多