<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<!--document.execCommand(sCommand[,交互方式, 动态参数]) -->
<div>

<a href="#" onclick=document.execCommand("selectAll") style="font-size:12px">全选</a>
<input type="button" name="Submit" value="2D-Position" onclick="document.execCommand('2D-Position',false,true)" />
<input type="button" name="Submit" value="全选" onclick="document.execCommand('SelectAll')"/>
<input type="button" name="Submit" value="复制" onclick="document.execCommand('Copy')"/>
<input type="button" name="Submit2" value="剪切" onclick="document.execCommand('Cut',false,null)"/>
<input type="button" name="Submit3" value="粘贴" onclick="document.execCommand('Paste')"/>
<input type="button" name="Submit4" value="清除" onclick="document.execCommand('Delete')"/>
<input type="button" name="Submit5" value="居中" onclick="document.execCommand('JustifyCenter')"/>
<input type="button" name="Submit6" value="靠左" onclick="document.execCommand('JustifyLeft')"/>
<input type="button" name="Submit7" value="靠右" onclick="document.execCommand('JustifyRight')"/>
<input type="button" name="Submit8" value="加粗" onclick="document.execCommand('Bold')" />
<input type="button" name="Submit9" value="斜体" onclick="document.execCommand('Italic')"/>
<input type="button" name="Submit10" value="下划线" onclick="document.execCommand('Underline')"/>
<input type="button" name="Submit11" value="背景色" onclick="document.execCommand('BackColor',false,'#0000ff')"/>
<input type="button" name="Submit12" value="打开" onclick="document.execCommand('Open')"/>
<input type="button" name="Submit13" value="另存为" onclick="document.execCommand('SaveAs')"/>
<input type="button" name="Submit14" value="打印" onclick="document.execCommand('Print')"/>
<input type="button" name="Submit15" value="改变字体" onclick="document.execCommand('FontName',false,'黑体')"/>
<input type="button" name="Submit16" value="字体大小" onclick="document.execCommand('FontSize',false,'20')"/>
<input type="button" name="Submit17" value="前景色" onclick="document.execCommand('ForeColor',false,'#ff0000')"/>
<input type="button" name="Submit18" value="绝对定位" onclick="document.execCommand('AbsolutePosition',false,true)" />
<input type="button" name="Submit19" value="设置锚点为书签" onclick="document.execCommand('CreateBookmark',false,'AnchorName')" />
<input type="button" name="Submit20" value="设置超链接" onclick="document.execCommand('CreateLink',false,'http://www.baidu.com')" />
<!-- 将选中文本变成超连接,若第二个参数为true,会出现参数设置对话框; -->
<input type="button" name="Submit21" value="设置标签名" onclick="document.execCommand('FormatBlock',false,'aaa')" />
<input type="button" name="Submit21" value="替换为按钮" onclick="document.execCommand('InsertButton')" />
    <!--
    InsertButton 用按钮控件覆盖当前选中区。
    InsertFieldset 用方框覆盖当前选中区。
    InsertHorizontalRule 用水平线覆盖当前选中区。
    InsertIFrame 用内嵌框架覆盖当前选中区。
    InsertImage 用图像覆盖当前选中区。
    InsertInputButton 用按钮控件覆盖当前选中区。
    InsertInputCheckbox 用复选框控件覆盖当前选中区。
    InsertInputFileUpload 用文件上载控件覆盖当前选中区。
    InsertInputHidden 插入隐藏控件覆盖当前选中区。
    InsertInputImage 用图像控件覆盖当前选中区。
    InsertInputPassword 用密码控件覆盖当前选中区。
    InsertInputRadio 用单选钮控件覆盖当前选中区。
    InsertInputReset 用重置控件覆盖当前选中区。
    InsertInputSubmit 用提交控件覆盖当前选中区。
    InsertInputText 用文本控件覆盖当前选中区。
    InsertMarquee 用空字幕覆盖当前选中区。
    InsertOrderedList 切换当前选中区是编号列表还是常规格式化块。
    InsertParagraph 用换行覆盖当前选中区。
    InsertSelectDropdown 用下拉框控件覆盖当前选中区。
    InsertSelectListbox 用列表框控件覆盖当前选中区。
    InsertTextArea 用多行文本输入控件覆盖当前选中区。
    InsertUnorderedList 切换当前选中区是项目符号列表还是常规格式化块。
    -->
<input type="button" name="Submit21" value="设置当前块格式化标签" onclick="document.execCommand('FormatBlock','false','p')" />
<input type="button" name="Submit21" value="缩进" onclick="document.execCommand('Indent')" />
<input type="button" name="Submit21" value="减少缩进" onclick="document.execCommand('Outdent')" />
<input type="button" name="Submit21" value="LiveResize" onclick="document.execCommand('LiveResize')" />
<!--LiveResize 迫使 MSHTML 编辑器在缩放或移动过程中持续更新元素外观,而不是只在移动或缩放完成后更新。-->
<!--MultipleSelection 允许当用户按住 Shift 或 Ctrl 键时一次选中多于一个站点可选元素。 -->
<input type="button" name="Submit21" value="OverWrite" onclick="document.execCommand('OverWrite')" />
<input type="button" name="Submit21" value="刷新" onclick="document.execCommand('Refresh')" />
<input type="button" name="Submit21" value="RemoveFormat" onclick="document.execCommand('RemoveFormat')" />
<input type="button" name="Submit21" value="UnBookmark" onclick="document.execCommand('UnBookmark')" />
<!--
    Unlink 从当前选中区中删除全部超级链接。
    Unselect 清除当前选中区的选中状态。
-->
</div>
<div align="center" id="ys">效果演示</div>
<br />
<div style="position:absolute; left:600px">aaaaa</div>
<div align="center">
<form id="form1" name="form1" method="post" action="">
<textarea name="textarea" style="width:600px; height:400px;" onchange="ys.innerHTML=this.value"></textarea>
</form>
</div>
</body>
</html>

posted on 2009-04-14 00:01  sunshinerains  阅读(832)  评论(0)    收藏  举报