The New York Times does this. Pick any story at http://nytimes.com/
and double-click a word.

It turns out that it's kind of annoying, actually, because it is
unexpected behavior. But that obviously varies case-by-case.

By the way, you shouldn't connect every span to an event. Just connect
the document and then look at event.target() to get the span.

Chris Snyder
http://chxor.chxo.com/

On Tue, Jul 8, 2008 at 1:21 PM, Per Cederberg <[EMAIL PROTECTED]> wrote:
>
> Or using double-click instead of single click. Then the standard text
> selection handling applies (not trivial cross-browser, but at least
> doable).
>
> Cheers,
>
> /Per
>
> On Tue, Jul 8, 2008 at 6:53 PM, Jason Bunting
> <[EMAIL PROTECTED]> wrote:
> >
> > I am not thinking hard about this, so if I am way off, someone will correct
> > me. :P
> >
> > Seems to me you would have to place just about every word (or, at least,
> > those you care about) in a span tag and connect to the onmouseover event or
> > onclick event of that span and then your handler could use scrapeText() to
> > get the value out.
> >
> >   connect(oneOfTheSpans, "onclick", function(eventArgs) {
> >      var textClickedOn = scrapeText(eventArgs.src());
> >   });
> >
> > I don't know, there is probably some much better way of doing this, but I
> > thought I would at least respond.
> >
> > Jason Bunting
> >
> >
> >> -----Original Message-----
> >> From: mochikit@googlegroups.com [mailto:[EMAIL PROTECTED] On
> >> Behalf Of Nilu
> >> Sent: Monday, July 07, 2008 9:11 PM
> >> To: MochiKit
> >> Subject: [mochikit] Get text under the mouse pointer via javascript
> >>
> >>
> >> Hi,
> >>
> >> I was wondering if it is at possible to get the word a user clicks on
> >> with javascript. For example if I click on "word" (note that it isn't
> >> inside a span, div or anchor element), the script would display
> >> "word".
> >>
> >> Another way of doing this would be to get the coordinates of the mouse
> >> and find the word which is at that point or the closest word to it.
> >>
> >> Is it possible at all? Please help
> >>
> >> cheers,
> >>
> >> Nilu
> >>
> >> >
> >>
> >> No virus found in this incoming message.
> >> Checked by AVG - http://www.avg.com
> >> Version: 8.0.138 / Virus Database: 270.4.6/1540 - Release Date: 7/8/2008
> >> 6:33 AM
> >
> >
> > >
> >
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to