编辑器中designMode和contentEditable的属性的介绍

所属分类: 网络编程 / 网页编辑器 阅读数: 1608
收藏 0 赞 0 分享
HtmlEdit.document.designMode="On";
HtmlEdit是iframe对象ID
IE 中可以设置contentEditable="true"
把div的contentEditable属性设置为 true,在IE浏览器中就可以看到效果了,div中元素都变成可以编辑的了。
<div id="tt" contentEditable="true"></div>
<body contentEditable="true"><!--则整个页面都可以编辑了-->。
Firefox中可以 使用javascript语句设置属性contentDocument.designMode为 "on"
iframeName.document.designMode="on" ;
其中iframeName 为iframe控件的name属性。
在 IE7和 FireFox2.0中测试通过。如果想先初始化加入一些内容及样式,代码示例如下:
复制代码 代码如下:

if(navigator.appName == "Microsoft Internet Explorer")
{
var IframeID=frames["HtmlEditor"];
if(navigator.appVersion.indexOf("MSIE 6.0",0)==-1){IframeID.document.designMode="On"}
IframeID.document.open();
IframeID.document.write(StyleEditorHeader);
IframeID.document.close();
IframeID.document.body.contentEditable = "True";
IframeID.document.body.innerHTML=HidenObjValue;
IframeID.document.body.style.fontSize="10pt";
}else
{
var _FF = navigator.userAgent.indexOf("Firefox")>-1?true:false;
var IframeID=getObject("HtmlEditor");
HtmlEditor=IframeID.contentWindow;
HtmlEditor.document.designMode="On"
HtmlEditor.document.open();
HtmlEditor.document.write(StyleEditorHeader);
HtmlEditor.document.close();
HtmlEditor.document.body.contentEditable = "True";
HtmlEditor.document.body.innerHTML=HidenObjValue;
}
更多精彩内容其他人还在看

eWebEditor 上传文件提示格式不正确的解决方法

eWebEditor上传个别图片时出现:请选择一个有效的文件,支持的格式有(GIF|JPG|JPEG|BMP|PNG)!,在WINDOWSXP下使用该组件正常,却在WINDOWS2003上提示
收藏 0 赞 0 分享

xhEditor的异步载入实现代码

xhEditor的异步载入实现代码,需要的朋友可以参考下。
收藏 0 赞 0 分享

FCKeditor 编辑器插入代码功能实现步骤

4步轻松打造可以应用于任何FCK编辑器的CMS及其他程序,一个Fckeditor编辑器的插件,it560独家首发教程,无需增加字段,不修改代码,完全绿色环保。
收藏 0 赞 0 分享

配置fckeditor 实现图片的上传

配置fckeditor 实现图片的上传
收藏 0 赞 0 分享

FCKeditor提供了一个完整的JavaScript API

FCKeditor提供了一个完整的JavaScript API(Application Public Interface),你可以利用这些API来处理FCK编辑器,只要它被加载完成或在正在运行中.
收藏 0 赞 0 分享

fckediter javascript事件函数代码

fckediter javascript事件函数代码,另外fckeditor的可以扩展性不错,大家可以学习下,具体的代码,可以参考脚本之家以前发布的文章。
收藏 0 赞 0 分享

ASP FCKeditor在线编辑器使用方法

我用的是asp,FCKeditor没有使用帮助,网上google以下资料很多,但不是很全,不适合刚入门的菜鸟使用,通过我半天的使用经历,稍微做了些整理,便于大家学习.
收藏 0 赞 0 分享

ASP下使用FCKeditor在线编辑器的方法

有不少朋友现在也喜欢用asp下用fckeditor编辑器了,下面是具体的使用方法。需要的朋友可以参考下。
收藏 0 赞 0 分享

ASP.NET中FCKEDITOR在线编辑器的用法

FCKEDITOR在线编辑器在asp.net下的使用方法,需要的朋友可以参考下。
收藏 0 赞 0 分享

php下FCKeditor2.6.5网页编辑器的使用方法

php下FCKeditor2.6.5网页编辑器的使用方法,需要的朋友可以参考下。
收藏 0 赞 0 分享
查看更多