日期:2009-03-22  浏览次数:20875 次

普通的方式是激活一个<iframe>进入编辑状态,命令如下
IframeNamer.document.designMode="On"

字体--宋体、黑体、楷体等
execCommand("fontname","",字体)
字号--字号大小
execCommand("fontsize","",字号)
加重
execCommand("Bold")
斜体
execCommand("Italic")
下划线
execCommand("Underline")
删除线
execCommand("StrikeThrough")
上标
execCommand("SuperScript")
下标
execCommand("SubScript")
有序排列--数字序号
execCommand("InsertOrderedList")
无序排列--圆点序号
execCommand("InsertUnorderedList")
向前缩进
execCommand("Outdent")
向后缩进
execCommand("Indent")
居左
execCommand("JustifyLeft")
居右
execCommand("JustifyRight")
居中
execCommand("JustifyCenter")
剪切
execCommand("Cut")
拷贝
execCommand("Copy")
粘贴
execCommand("Paste")
覆盖
execCommand("Overwrite")
取消操作--IE5.0以后可以无限取消
execCommand("Undo")
重复操作
execCommand("Redo")
设置链接--若按以下写法,在IE5.0版本中会激活一个内建窗口,可以完成输入链接的功能,而且还可以选择MAILTO、FTP等各种链接类型,比较方便
execCommand("CreateLink")
在IE4.0中,没有内建链接输入窗口,所以就需要用以下方式嵌入链接
execCommand("CreateLink","",TURL)
插入图片--由于IE中嵌入的可编控件是针对本地资源的,所以其默认的图片资源来自本地,所以基于WEB内容的编辑最好自己做输入框,然后用如下命令实现。
execCommand("InsertImage","",ImgURL)
字体颜色
execCommand("ForeColor","",CColor)

背景色
我没有找到直接在execCommand命令中控制背景色的参数,而是用如下方式实现的

IframeName.document.body.style.backgroundColor=ChangeColor

背景图
IframeName.document.body.style.backgroundImage="URL('***')"

以上是我做的一个邮件内容编辑中用到的属性,本想增加更多可编辑项,但工期短,没来得及做,有兴趣的朋友可以来信讨论。