欢迎光临
我们一直在努力

饮水思源,我从这里学到的知识投入应用,现在再奉献回给大家(可编辑页面的部分属性)

建站超值云服务器,限时71元/月

普通的方式是激活一个<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(***)"

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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 饮水思源,我从这里学到的知识投入应用,现在再奉献回给大家(可编辑页面的部分属性)
分享到: 更多 (0)

相关推荐

  • 暂无文章