Re: Determining marked text
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Determining marked text

From: Aaron Gray <ang.usenet@gmail.com>
Date: Tue Apr 04 2006 - 21:27:54 CEST

>> In theses JavaScript WYSIWYG editors how do they determine if and where
>> there is marked (highlighted) text ?
>
> Mozilla exposes a proprietary selection object as a result of
> window.getSelection() e.g.
> var selection = window.getSelection();
> If you simply want the text then all you need is
> selection.toString()
> but that object has an API with properties and methods and is composed of
> W3C DOM ranges you can manipulate, see
> <http://xulplanet.com/references/objref/Selection.html>
>
> IE/Win has its own different proprietary selection and range API, see
> <http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_selection.asp>

Thanks,

Aaron
Received on Mon May 1 04:41:08 2006