quick question: highlighting a selection
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

quick question: highlighting a selection

From: <anita1766@yahoo.com>
Date: Wed Dec 14 2005 - 21:08:38 CET

Hello all,
I'd like to be able to highlight an arbitrary user selected text,
inside a document. Is this possible ?
I am thinking that I'd have to create an element of the selected string
and insert it into the dom, but am not sure how to do this, as the
insertion point could be inside any enclosing html
like so

<P>
Lorem ipsum dolor amet sit amet ipso facto. Lorem ipsum dolor amet sit
amet ipso facto. Lorem ipsum dolor amet sit amet ipso facto. USER
SELECTED TO BE HIGHLIGHTED TEXT sit amet ipso facto. Lorem ipsum dolor
amet sit amet ipso facto. Lorem ipsum dolor amet sit amet ipso facto.
Lorem ipsum dolor amet sit amet ipso.
</P>

The user selects USER SELECTED TO BE HIGHLIGHTED TEXT.

Thanks much
Received on Fri Dec 23 20:21:54 2005