html在线编辑器

web在线编辑器原理

<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
HTML编辑器
ID.document.designMode="on"使iframe处在可编辑状态为off时为不可以编辑
ID.focus();获取当前iframe的焦点
ID.document.selection.createRange();获取文本框中选中区内容
ID.document.execCommand(s);在当前文档、选中区或给定范围上执行命令
execCommand参数
ID.document.execCommand('Cut');剪切
ID.document.execCommand('Copy')拷贝
ID.document.execCommand('Paste')粘贴
ID.document.execCommand('Undo')撤消
ID.document.execCommand('Redo')重做
ID.document.execCommand('Delete')删除
ID.document.execCommand('Bold')黑体
ID.document.execCommand('Italic')斜体
ID.document.execCommand('Underline')下划线
ID.document.execCommand('StrikeThrough');在选中的文字上划粗线
ID.document.execCommand('SuperScript');将选中的部分文字变细
ID.document.execCommand('Underline');将选中区块的下划线取消掉
ID.document.execCommand('stop')停止
ID.document.execCommand('SaveAs')保存
ID.document.execCommand('Saveas',false,'c://test.htm')另存为
ID.document.execCommand('FontName',false,'标楷体')字体字体必须是系统支持的字体true或false都可以
ID.document.execCommand('FontSize',false,fs)字体大小
ID.document.execCommand('refresh',false,0)刷新
ID.document.execCommand('CreateLink',true,'true')弹出一个对话框输入URL创建一个超链接
ID.document.execCommand('CreateLink',false,'http://www.51js.com')创建一个超链接
ID.document.execCommand('BackColor',true,'#FFbbDD')将选中的区块设为指定的背景色true或false都可以
ID.document.execCommand('ForeColor',false,'#BBDDCC')指定前景色true或false都可以
ID.document.execCommand('FontSize',false,7)指定背景色true或false都可以
ID.document.execCommand('InsertOrderedList')有序列排列
ID.document.execCommand('InsertUnorderedList')实心无序列排列
ID.document.execCommand('Indent')空心无序列排列
ID.document.execCommand('Delete')删除选中的区块
ID.document.execCommand('Cut')剪下选中的区块
表单类
ID.document.execCommand('InsertButton',false,"aa")新增加一个Button true或false无效 document.all.aa.value="风舞九天"
ID.document.execCommand('InsertInputButtong',false,"aa")新增加一个input true或false无效 document.all.aa.value="风舞九天"
ID.document.execCommand('InsertFieldSet',true,"aa")重设为一个fieldset document.all.aa.innerText="刀剑如梦"
ID.document.execCommand('InsertHorizontalRule',true,"aa")插入一个水平线
ID.document.execCommand('InsertIFrame',true,"aa")插入一个iframe
ID.document.execCommand('InsertImage',false,"aa")插入一个InsertImage,设为true时需要图片,false时不需图片
ID.document.execCommand('InsertInputCheckbox',true,"aa")插入一个checkbox
ID.document.execCommand('InsertInputFileUpload',false,"aa")插入一个file类型的object
ID.document.execCommand('InsertInputHidden',false,"aa")插入一个hidden
ID.document.execCommand('InsertInputImage',false,"aa")插入一个InputImage document.all.aa.src="F-a10.gif";
ID.document.execCommand('InsertInputPassword',true,"aa")插入一个Password
ID.document.execCommand('InsertInputRadio',false,"aa")插入一个Radio
ID.document.execCommand('InsertInputReset',true,"aa")插入一个Reset
ID.document.execCommand('InsertInputSubmit',false,"aa")插入一个Submit
ID.document.execCommand('InsertInputText',false,"aa")插入一个input text
ID.document.execCommand('InsertTextArea',true,"aa")插入一个textarea
ID.document.execCommand('InsertSelectListbox',false,"aa")插入一个 select list box
ID.document.execCommand('InsertSelectDropdown',true,"aa")插入一个single select
ID.document.execCommand('InsertParagraph')插入一个line break(硬回车??)
ID.document.execCommand('InsertMarquee',true,"aa")插入一个marquee document.all.aa.innerText="bbbbb"
ID.document.execCommand('Unselect')于取消选中的阴影部分
ID.document.execCommand('SelectAll')选中页面上的所有元素
ID.document.execCommand('SaveAs','mycodes.txt');第二个参数为欲保存的文件名
ID.document.execCommand('print')打印整个页面
ID.document.execCommand("SuperScript")上标
ID.document.execCommand("SubScript")下标
ID.document.execCommand("Outdent")向前缩进
ID.document.execCommand("Indent")向后缩进
ID.document.execCommand("JustifyLeft")居左
ID.document.execCommand("JustifyRight")居右
ID.document.execCommand("JustifyCenter")居中
ID.document.execCommand("ForeColor","",CColor)字体颜色
在焦点位置上插入html
ID.focus(); //获取当前iframe的焦点
o = ID.document.selection.createRange();//获取文本框中选中区内容
o.pasteHTML("<img src=/"/" width=/"100/" height=/"100/">")
  
  
  
  
  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值