我发现在ie6.0下xtype:'form' Fckeditor好像使用不正常无法显示出来,但ff ie7都是正常的,人有知道解决的方法吗
Ext.onReady(function(){
var win = new Ext.Window({
title: 'Ext和Fckeditor结合示例',
width: 800,
height: 600,
deferredRender:false,
name:'fcktest',
items:[{
xtype:'form',
items:[{
xtype:'textarea',
name:'fbContent',
id:'fbContent',
fieldLabel:'Content',
height:270,
listeners : {
'render' : {
fn : function(field) {
var oFCKeditor = new FCKeditor( 'fbContent' ) ;
oFCKeditor.BasePath = '/FCKeditor/' ;
oFCKeditor.ToolbarSet = 'Sitecfg' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '350' ;
oFCKeditor.ReplaceTextarea() ;
},
scope : this
}
}
}]
}]
});
win.show();
extjs内如果是from方式Fckeditor不能在ie6.0下使用
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- zhoujuan520 2009-05-02 14:57关注
下面代码在火狐 ie6,ie7都测试通过
脚本 a.js
[code="js"]
var sFCKeditorToolbar = 'Default';
var sFCKeditorBasePath = '/ext-2.2-web/fckeditor/';//指定绝对路径工程名称+fck编辑器目录
var sFCKeditorBaseHref = 'http://localhost:8080/ext-2.2-web/';//工程路径
var sFCKeditorSkinPath = '/ext-2.2-web/fckeditor/editor/skins/office2003/';//皮肤路径
Ext.form.FCKeditor = function(config) {
Ext.form.FCKeditor.superclass.constructor.call(this, config);
this.FCKid = 0;
this.MyisLoaded = false;
this.MyValue = '';
};Ext.extend(Ext.form.FCKeditor, Ext.form.TextArea, {
onRender : function(ct, position) {
if (!this.el) {
this.defaultAutoCreate = {
tag : "textarea",
style : "width:100px;height:60px;",
autocomplete : "off"
};
}
Ext.form.TextArea.superclass.onRender.call(this, ct, position);
if (this.grow) {
this.textSizeEl = Ext.DomHelper.append(document.body, {
tag : "pre",
cls : "x-form-grow-sizer"
});
if (this.preventScrollbars) {
this.el.setStyle("overflow", "hidden");
}
this.el.setHeight(this.growMin);
}
if (this.FCKid == 0)
this.FCKid = get_FCKeditor_id_value()
setTimeout("loadFCKeditor('" + this.name + "');", 100);
},
setValue : function(value) {
this.MyValue = value;
if (this.FCKid == 0)
this.FCKid = get_FCKeditor_id_value()
FCKeditorSetValue(this.FCKid, this.name, value)
Ext.form.TextArea.superclass.setValue.apply(this, [value]);
},getValue : function() { if (this.MyisLoaded) { value = FCKeditorGetValue(this.name); Ext.form.TextArea.superclass.setValue.apply(this, [value]); return Ext.form.TextArea.superclass.getValue(this); } else { return this.MyValue; } }, getRawValue : function() { if (this.MyisLoaded) { value = FCKeditorGetValue(this.name); Ext.form.TextArea.superclass.setRawValue.apply(this, [value]); return Ext.form.TextArea.superclass.getRawValue(this); } else { return this.MyValue; } }
});
Ext.reg('fckeditor', Ext.form.FCKeditor);function loadFCKeditor(element) {
oFCKeditor = new FCKeditor(element);
oFCKeditor.ToolbarSet = sFCKeditorToolbar;
oFCKeditor.Config['SkinPath'] = sFCKeditorSkinPath;
oFCKeditor.Config['PreloadImages'] = sFCKeditorSkinPath + 'images/toolbar.start.gif' + ';' + sFCKeditorSkinPath
+ 'images/toolbar.end.gif' + ';' + sFCKeditorSkinPath + 'images/toolbar.bg.gif' + ';' + sFCKeditorSkinPath
+ 'images/toolbar.buttonarrow.gif';
oFCKeditor.BasePath = sFCKeditorBasePath;
oFCKeditor.Config['BaseHref'] = sFCKeditorBaseHref;
oFCKeditor.Height = 260;
oFCKeditor.ReplaceTextarea();}
function FCKeditor_OnComplete(editorInstance) {Ext.getCmp(editorInstance.Name).MyisLoaded = true; editorInstance.Events.AttachEvent('OnStatusChange', function() { Ext.getCmp(editorInstance.Name).setValue(); })
}
var FCKeditor_value = new Array();
function FCKeditorSetValue(id, name, value) {
if ((id != undefined) && (name != undefined)) {
if (value != undefined)
FCKeditor_value[id] = value;
else if (FCKeditor_value[id] == undefined)
FCKeditor_value[id] = '';
var oEditor = FCKeditorAPI.GetInstance(name);if (oEditor != undefined) oEditor.SetData(FCKeditor_value[id]) }
}
function FCKeditorGetValue(name) {
if ((id != undefined) && (name != undefined)) {
var oEditor = FCKeditorAPI.GetInstance(name);
data = '';
if (oEditor != undefined)
data = oEditor.GetData()
return data;
}
}
var FCKeditor_id_value;
function get_FCKeditor_id_value() {
if (!FCKeditor_id_value) {
FCKeditor_id_value = 0;
}
FCKeditor_id_value = FCKeditor_id_value + 1;
return FCKeditor_id_value;
}Ext.onReady(function() {
var fckeditorFormPanel = new Ext.FormPanel({
labelWidth : 35,
title : 'fckeditor Form',
width : 850,
defaultType : 'textfield',
items : [{
xtype : 'fckeditor',
name : 'n_context',
id : 'n_context',
fieldLabel : '内容',
height : 400
}]
});
fckeditorFormPanel.render(document.body);
});[/code]
页面 a.html
[code="html"]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
a.html<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="ext-2.2/resources/css/ext-all.css"> <link href="fckeditor/_samples/sample.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="ext-2.2/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext-2.2/ext-all.js"></script> <script type="text/javascript" src="fckeditor/fckeditor.js"></script> <script type="text/javascript" src="a.js"> </script> </head> <body> </body>
[/code]
项目路径大概如下
ext-2.2-web
--src
--WebRoot
----ext-2.2
----fckeditor
----WEB-INF
----a.html
----a.js程序运行截图
[img]http://yourgame.iteye.com/upload/picture/pic/36245/35d4b828-6874-3aea-a557-b668036d2e49.gif[/img]
[url]http://yourgame.iteye.com/upload/picture/pic/36245/35d4b828-6874-3aea-a557-b668036d2e49.gif[/url]
火狐[img]http://yourgame.iteye.com/upload/picture/pic/36247/6e61826c-882a-3907-bb9a-f15742b92e6c.gif[/img]
[url]http://yourgame.iteye.com/upload/picture/pic/36247/6e61826c-882a-3907-bb9a-f15742b92e6c.gif[/url]
IE7[img]http://yourgame.iteye.com/upload/picture/pic/36249/96c43189-afc9-324d-8821-fb1ea67bf51b.gif[/img]
[url]http://yourgame.iteye.com/upload/picture/pic/36249/96c43189-afc9-324d-8821-fb1ea67bf51b.gif[/url]
ie6本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 VAE代码如何画混淆矩阵
- ¥15 求遗传算法GAMS代码
- ¥15 雄安新区高光谱数据集的下载网址打不开
- ¥66 android运行时native和graphics内存详细信息获取
- ¥100 求一个c#通过CH341读取数据的Demo,能够读取指定地址值的功能
- ¥15 rk3566 Android11 USB摄像头 微信
- ¥15 torch框架下的强化学习DQN训练奖励值浮动过低,希望指导如何调整
- ¥35 西门子博图v16安装密钥提示CryptAcquireContext MS_DEF_PROV Error of containger opening
- ¥15 mes系统扫码追溯功能
- ¥40 selenium访问信用中国