文本区域选择索引 [英] Textarea Selection Index

查看:43
本文介绍了文本区域选择索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站中有一个 textarea 控件.我想为 Internet Explorer 检索文本区域中所选文本的开始和结束位置.

I have a textarea control in my website. I want to retrieve start and end position of selected text in the text area, for Internet Explorer.

我该怎么做?

推荐答案

我可以鼓励您使用 Rangy?

一个跨浏览器的 JavaScript 范围和选择库.它提供了一个简单的基于标准的 API,用于在所有主要浏览器中执行常见的 DOM 范围和选择任务,抽象出 Internet Explorer 和 DOM 兼容浏览器之间此功能的巨大不同实现.

A cross-browser JavaScript range and selection library. It provides a simple standards-based API for performing common DOM Range and Selection tasks in all major browsers, abstracting away the wildly different implementations of this functionality between Internet Explorer and DOM-compliant browsers.

请参阅Rangy 中的选择对象.

这篇关于文本区域选择索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆