• 部分FCKeditor常用JS函数


    // JScript 文件
      
    //预览
    function preview() {
    oFCKeditor.Value=FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML(true);
    FCKeditorAPI.GetInstance('FCKeditor1').Preview();
    }
    //源代码/编辑转换
    function viewsrc()
    {
    var obj=FCKeditorAPI.GetInstance('FCKeditor1');
    oFCKeditor.Value=obj.GetXHTML(true);
    obj.SwitchEditMode(FCK_EDITMODE_SOURCE);
    if(obj.EditMode==FCK_EDITMODE_SOURCE)
    {
    document.getElementById("btn_src").value="编辑";
    document.getElementById("btn_src").title="以所见即所得模块编辑";
    }
    else
    {
    document.getElementById("btn_src").value="源代码";
    document.getElementById("btn_src").title="以源代码模块编辑";
    }
      
    }
    //增加编辑区大小
    function upsize()
    {
      var height=oFCKeditor.Height;
      if(height<1200)
      {
        oFCKeditor.Height=oFCKeditor.Height+200;
        document.getElementById("FCKeditor1___Frame").height=oFCKeditor.Height;
      } 
      if(oFCKeditor.Height>1000)
        document.getElementById("btn_upsize").disabled="disabled";
      document.getElementById("btn_downsize").disabled="";    
    }
    //减小编辑区大小
    function downsize()
    {
      var height=oFCKeditor.Height;
      if(height>200)
      {
        oFCKeditor.Height=oFCKeditor.Height-200;
        document.getElementById("FCKeditor1___Frame").height=oFCKeditor.Height;
      }
      if(oFCKeditor.Height<400)
        document.getElementById("btn_downsize").disabled="disabled";
      document.getElementById("btn_upsize").disabled="";
      
    }
    //去除字符串首尾空格
    String.prototype.trim = function()
    {
        // 用正则表达式将前后空格
        // 用空字符串替代。
        return this.replace(/(^s*)|(s*$)/g, "");
    }
    //重置编辑器(清空)
    function resetFCKEditor()
    {
    FCKeditorAPI.GetInstance('FCKeditor1').SetHTML("");
    }
    //插入HTML代码到当前位置
    function inserthtml()
    {
      var htmlstr=document.getElementById("insertstr").value;
      if(htmlstr.length>2)
      {
        FCKeditorAPI.GetInstance('FCKeditor1').InsertHtml(htmlstr);
      }
      document.getElementById("insertstr").value="";
    }
  • 相关阅读:
    mysql-connector-java(6.0以上)的时差问题
    Mysql中的Date转换
    Intellij idea 告警:'while' statement cannot complete without throwing an exception
    JavaScript数组的操作
    Intellij idea 告警:URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)
    【网络文摘】2016年里做前端是怎样一种体验
    【JavaScript Demo】回到顶部功能实现
    【JavaScript 插件】实现图片倒影效果
    【读书笔记《Bootstrap 实战》】6.单页营销网站
    【读书笔记《Bootstrap 实战》】5.电子商务网站
  • 原文地址:https://www.cnblogs.com/yeagen/p/1370897.html
Copyright © 2020-2023  润新知