[Javascript] Text selection property/method?

William T. Simmons tsimmons at employmentlawadvisors.com
Wed Feb 11 19:47:18 CST 2004


Same here - I've got a particular project for which I would love to find a
solution that works on NS/Mozilla. I should have made it clear in my post
that the "execCommand()" functionality works only in IE.
Tommy Simmons
Employment Law Advisory Network
www.employmentlawadvisors.com

----- Original Message ----- 
From: "Peter Brunone" <peter at brunone.com>
To: "'[JavaScript List]'" <javascript at LaTech.edu>
Sent: Wednesday, February 11, 2004 1:51 PM
Subject: RE: [Javascript] Text selection property/method?


>
> Thanks to everyone who responded; I have what I need for now.
>
> David (or anybody), if you come across a valid approach for
> Mozilla, let me know!
>
> Cheers,
>
> Peter
>
> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu] On Behalf Of David Lovering
>
> 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>
>
> > 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>
> >
> > > 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