[转]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 " ,   
      width:
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,   
   width: 
400  , height:  200  ,autoScroll:  true  ,   
   html: 
' <h1> ' +  str  + ' </h1> '        
  });   
  win.show();   
 }   
});  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值