document.selection.createRange
来源:互联网 发布:yy歌手排行女知多少 编辑:程序博客网 时间:2024/05/14 14:28
最近在做编辑器,需要对编辑器研究下,发现document.selection.createRange这个挺有用的。
document.selection.createRange方法:
document.selection.createRange() 根据当前文字选择返回 TextRange 对象,或根据控件选择返回 ControlRange 对象。配合 execCommand,在 HTML 编辑器中很有用,比如:文字加粗、斜体、复制、粘贴、创建超链接等。
一个简单的例子
<html><head><title>document.selection.createRange例子</title></head><body>
<div>请选中这里的部分文字。</div><div><input type="button" value="加粗" onclick="javascript :Bold();" /></div>
<script language="javascript">
function Bold(){
var bo = document.selection.createRange();
bo.execCommand("Bold");
}</script>
</body></html>
- document.selection.createRange方法
- document.selection.createRange
- document.selection.createRange方法
- document.selection.createRange()
- document.selection.createRange方法
- document.selection.createRange方法
- document.selection.createRange方法
- document.getSelection,document.selection.createRange
- document.getSelection,document.selection.createRange
- JS document.selection.createRange方法
- JS document.selection.createRange方法
- document.selection 的 createRange()方法汇总
- DHTML之-----document.selection 的 createRange
- document.selection.createRange方法----获取选择对象文本
- 网页中获取当前选取的内容 document.getSelection,document.selection.createRange
- 获取 Textarea 元素当前的光标位置及document.selection.createRange()资料
- 获取Textarea 元素当前的光标位置及document.selection.createRange()资料
- IFrame 系列4 ---- document.selection 全方位兼容解析以及TextRange[createTextRange,createRange]对象的深入解析
- applet授权数字签名
- HTTP协议详解
- pccontrol
- 老牛破车般的CSDN博客
- 虚函数
- document.selection.createRange
- 创建存储过程及调用存储过程
- JSP EL
- 什么是Windows Virtual PC?
- RHEL4内核编译步骤简介
- ff下的document.selection
- 我有一个梦想--3G时代
- Access DB压缩函数gf_compactandrepairaccessdb
- 放大你的格局,人一辈子要有一次壮遊