[Javascript] Text selection property/method?

David Lovering dlovering at gazos.com
Wed Feb 11 13:31:47 CST 2004


Tommy's method is OK for IE, but a prelim test shows that it doesn't work on
the Netscape/Mozilla boxes I tried.

-- Dave Lovering

----- Original Message ----- 
From: "William T. Simmons" <tsimmons at employmentlawadvisors.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, February 11, 2004 12:57 AM
Subject: Re: [Javascript] Text selection property/method?


> How about something like this, once the mouse-drag event has been trapped:
> var rangeRef = document.selection.createRange();
>
> (from Danny Goodman's JavaScript Bible, 4th Ed., Chap. 19)
>
> Once the selection range object is created, you can then perform
operations
> on it, such as with "execCommand()":
> "rangeRef.execCommand("BackColor","false","yellow")", or
> "rangeRef.execCommand("Italic").
>
> HTH,
> Tommy Simmons
> Employment Law Advisory Network
> www.employmentlawadvisors.com
>
> ----- Original Message ----- 
> From: "Peter Brunone" <peter at brunone.com>
> To: <javascript at latech.edu>
> Sent: Tuesday, February 10, 2004 11:35 PM
> Subject: [Javascript] Text selection property/method?
>
>
> > List,
> >
> > I'm trying to find a way (in IE right now, but may need it for
> > Mozilla later) to identify and alter the region selected by a mouse drag
> > (usually identified by highlighting in a color opposite the background).
> > The selected text will most likely be in a TD.  Any thoughts on what
> > this mysterious attribute might be called?
> >
> > Cheers,
> >
> > Peter Brunone
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>





More information about the Javascript mailing list