zoukankan      html  css  js  c++  java
  • [转]ExtJs里使用FckEditor

    原贴见:

    http://ext.group.javaeye.com/group/post/37548

    http://extjs.com/forum/showthread.php?t=17423

    Ext.onReady(function() {   
     
    var fckFormObj = new Ext.FormPanel({   
      labelWidth:
    75,   
      url:
    "",   
      title:
    "EXT/FCKEditor 集成 -- vb2005xu | cdlinux.ys168.com",   
      bodyStyle:
    "padding:5px 5px 0",   
      defaultType:
    "form",   
      buttons:[   
       {   
        text:
    "Save" ,   
        type:
    'submit',   
        handler: 
    function(){   
         
    //获取fckeditor内容赋给textarea   
         Ext.get('fckInstance').dom.value = "jjj";//fckobj.GetXHTML(true) + '提交后';     
         Ext.MessageBox.alert('FCK内容',Ext.get('fckInstance').dom.value);   
         
    if (fckFormObj.form.isValid())   
         {   
          
    //创建响应测试函数         
          var fckobj_temp = FCKeditorAPI.GetInstance('fckInstance');   
          
    //fckobj_temp.UpdateLinkedField();//此方法被绑定到submit事件   
             
          fckFormObj.form.doAction(
    'submit',{   
           url:
    'submit.php',   
           method:
    'post',   
           waitMsg:
    '正在提交,请稍等',   
            success:
    function(form,action){//成功   
             showInfo('Success',fckobj_temp.GetXHTML(true));   
            } ,   
            failure:
    function(form,action){//失败   
             showInfo('Failed','网络中断造成连接失败');   
            }   
          });   
         }   
        }   
       },   
       {   
        text:
    "Cancel"  
       }   
      ],   
      items:[{   
          xtype:
    "textarea",   
          fieldLabel:
    "编辑",   
          labelSeparator:
    "",   
          id:
    "fckInstance"//div节点,这里要挂接FCKeditor编辑器   
          name:"fckInstance",   
          
    736,   
          height:
    371  
      }]   
     });   
     fckFormObj.render(document.body);   
        
     
    /*创建Fckeditor对象 -- 构造函数指出了Fckeditor要挂接的id,上文中的xtype : 'textarea'指定*/  
     
    //在页面上要求挂载fckeditor/fckeditor.js文件   
     var fckobj = new FCKeditor('fckInstance',810,350);   
     fckobj.BasePath 
    = "/ucren/fckeditor/" ;   
     fckobj.ToolbarSet 
    = 'Default' ;   
     fckobj.ReplaceTextarea();    
        
     
    //创建响应测试函数   
     function msgBox()   
     {   
      
    var fckobj_temp = FCKeditorAPI.GetInstance('fckInstance');   
      fckobj_temp.UpdateLinkedField();
    //此方法被绑定到submit事件   
      Ext.MessageBox.alert('FCK内容',fckobj_temp.GetXHTML( true ));   
         
     }   
        
     
    function showInfo(tip,str){   
      
    var win = new Ext.Window({   
       title: 
    '信息提交应答提示 -- ' + tip,   
        
    400 , height: 200 ,autoScroll: true ,   
       html: 
    '<h1>'+ str +'</h1>'       
      });   
      win.show();   
     }   
    });  
    作者:菩提树下的杨过
    出处:http://yjmyzz.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    第03组 团队Git现场编程实战
    团队Git现场编程实战
    第二次结对编程作业
    团队项目-需求分析报告
    团队项目-选题报告
    第一次结对编程作业
    第一次个人编程作业
    第一次博客作业
    第四组 团队Git现场编程实战
    第二次结对编程作业
  • 原文地址:https://www.cnblogs.com/yjmyzz/p/1280760.html
Copyright © 2011-2022 走看看